[CalendarServer-changes] [14251] twext/trunk/twext/enterprise/dal/model.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jan 6 13:35:29 PST 2015
Revision: 14251
http://trac.calendarserver.org//changeset/14251
Author: cdaboo at apple.com
Date: 2015-01-06 13:35:29 -0800 (Tue, 06 Jan 2015)
Log Message:
-----------
Clean-up.
Modified Paths:
--------------
twext/trunk/twext/enterprise/dal/model.py
Modified: twext/trunk/twext/enterprise/dal/model.py
===================================================================
--- twext/trunk/twext/enterprise/dal/model.py 2015-01-06 20:03:24 UTC (rev 14250)
+++ twext/trunk/twext/enterprise/dal/model.py 2015-01-06 21:35:29 UTC (rev 14251)
@@ -121,27 +121,30 @@
UNIQUE = "UNIQUE"
def __init__(self, type, affectsColumns, name=None):
+ self.type = type
self.affectsColumns = affectsColumns
- # XXX: possibly different constraint types should have different
- # classes?
- self.type = type
+ self.columnNames = tuple([c.name for c in self.affectsColumns])
self.name = name
def __repr__(self):
- return "<Constraint: ({} {} {})>".format(self.type, [c.name for c in self.affectsColumns], self.name)
+ return "<Constraint: ({} {} {})>".format(self.type, self.columnNames, self.name)
def __hash__(self):
- return hash(self.__repr__())
+ return hash((self.type, self.columnNames, self.name,))
def __eq__(self, other):
- return self.__repr__() == other.__repr__()
+ return (
+ self.type == other.type and
+ self.columnNames == other.columnNames and
+ self.name == other.name
+ )
def __ne__(self, other):
- return self.__repr__() != other.__repr__()
+ return not self.__eq__(other)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150106/35741180/attachment.html>
More information about the calendarserver-changes
mailing list