[CalendarServer-changes] [9621] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:54:59 PDT 2012
Revision: 9621
http://trac.macosforge.org/projects/calendarserver/changeset/9621
Author: glyph at apple.com
Date: 2012-08-11 01:54:58 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
Make the update test pass.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/q/
Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py 2012-08-11 08:54:58 UTC (rev 9620)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py 2012-08-11 08:54:58 UTC (rev 9621)
@@ -75,16 +75,22 @@
val = []
for col in self._primaryKeyExpression().columns:
val.append(getattr(self, self.__class__.__colmap__[col]))
+ return val
@classmethod
+ def _primaryKeyComparison(cls, primaryKey):
+ return (cls._primaryKeyExpression() ==
+ Tuple(map(Constant, primaryKey)))
+
+
+ @classmethod
@inlineCallbacks
def load(cls, txn, *primaryKey):
tbl = cls.__tbl__
- pkey = cls._primaryKeyExpression()
allColumns = list(tbl)
slct = Select(allColumns, From=tbl,
- Where=pkey == Tuple(map(Constant, primaryKey)))
+ Where=cls._primaryKeyComparison(primaryKey))
rows = yield slct.on(txn)
row = rows[0]
self = cls()
@@ -129,8 +135,8 @@
for k, v in kw.iteritems():
colmap[self.__attrmap__[k]] = v
yield (Update(colmap,
- Where=self._primaryKeyExpression() == self._primaryKeyValue()
- ).on(self.__txn__))
+ Where=self._primaryKeyComparison(self._primaryKeyValue()))
+ .on(self.__txn__))
self.__dict__.update(kw)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/72e2c6e4/attachment.html>
More information about the calendarserver-changes
mailing list