[CalendarServer-changes] [9582] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:54:27 PDT 2012
Revision: 9582
http://trac.macosforge.org/projects/calendarserver/changeset/9582
Author: glyph at apple.com
Date: 2012-08-11 01:54:27 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
OK make the 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:26 UTC (rev 9581)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py 2012-08-11 08:54:27 UTC (rev 9582)
@@ -24,6 +24,7 @@
from twisted.internet.defer import inlineCallbacks, returnValue
from twext.enterprise.dal.syntax import Select, Tuple, Constant, ColumnSyntax
+from twext.enterprise.dal.syntax import Insert
@@ -45,15 +46,24 @@
@classmethod
- def create(cls, *a, **k):
+ @inlineCallbacks
+ def create(cls, txn, *a, **k):
"""
Create a row.
"""
- # tbl = cls.__tbl__
+ tbl = cls.__tbl__
self = cls()
+ colmap = {}
+ allColumns = list(tbl)
+ attrtocol = {}
+ for column in allColumns:
+ attrtocol[column.model.name.lower()] = column
for attr in k:
setattr(self, attr, k[attr])
- return self
+ # FIXME: better error reporting
+ colmap[attrtocol[attr]] = k[attr]
+ yield Insert(colmap).on(txn)
+ returnValue(self)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/de534b73/attachment.html>
More information about the calendarserver-changes
mailing list