[CalendarServer-changes] [7020] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 16 06:42:43 PST 2011


Revision: 7020
          http://trac.macosforge.org/projects/calendarserver/changeset/7020
Author:   glyph at apple.com
Date:     2011-02-16 06:42:43 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify  NotificationObject.xmldata(), remove _fieldQuery

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
    CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql_legacy.py

Modified: CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:42:32 UTC (rev 7019)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:42:43 UTC (rev 7020)
@@ -2772,21 +2772,17 @@
         self._objectText = xmldata
 
 
-    @inlineCallbacks
-    def _fieldQuery(self, field):
-        data = yield self._txn.execSQL(
-            "select " + field + " from NOTIFICATION "
-            "where RESOURCE_ID = %s",
-            [self._resourceID]
-        )
-        returnValue(data[0][0])
+    _xmlDataFromID = Select(
+        [_objectSchema.XML_DATA], From=_objectSchema,
+        Where=_objectSchema.RESOURCE_ID == Parameter("resourceID"))
 
 
     @inlineCallbacks
     def xmldata(self):
-        
         if self._objectText is None:
-            self._objectText = (yield self._fieldQuery("XML_DATA"))
+            self._objectText = (
+                yield self._xmlDataFromID.on(
+                    self._txn, resourceID=self._resourceID))
         returnValue(self._objectText)
 
 

Modified: CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql_legacy.py	2011-02-16 14:42:32 UTC (rev 7019)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql_legacy.py	2011-02-16 14:42:43 UTC (rev 7020)
@@ -70,7 +70,7 @@
                 NotificationRecord(
                     notificationObject.uid(),
                     notificationObject.name(),
-                    (yield notificationObject._fieldQuery("XML_TYPE"))
+                    (yield notificationObject.xmlType().toxml())
                 )
             )
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/bb61aa0b/attachment.html>


More information about the calendarserver-changes mailing list