[CalendarServer-changes] [14571] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 11 19:51:01 PDT 2015


Revision: 14571
          http://trac.calendarserver.org//changeset/14571
Author:   cdaboo at apple.com
Date:     2015-03-11 19:51:01 -0700 (Wed, 11 Mar 2015)
Log Message:
-----------
Cross-pod pg8000 fixes.

Modified Paths:
--------------
    CalendarServer/trunk/.project
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/podding/store_api.py
    CalendarServer/trunk/txdav/common/datastore/sql.py

Modified: CalendarServer/trunk/.project
===================================================================
--- CalendarServer/trunk/.project	2015-03-12 01:39:48 UTC (rev 14570)
+++ CalendarServer/trunk/.project	2015-03-12 02:51:01 UTC (rev 14571)
@@ -6,15 +6,13 @@
 		<project>CalDAVClientLibrary</project>
 		<project>cffi</project>
 		<project>kerberos</project>
+		<project>pg8000</project>
 		<project>psutil</project>
 		<project>pycalendar</project>
 		<project>pycparser</project>
 		<project>pycrypto</project>
-		<project>PyGreSQL</project>
 		<project>pyOpenSSL</project>
-		<project>python-ldap</project>
 		<project>service_identity</project>
-		<project>sqlparse</project>
 		<project>twextpy</project>
 		<project>Twisted</project>
 		<project>zope.interface-4.0.3</project>

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-03-12 01:39:48 UTC (rev 14570)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-03-12 02:51:01 UTC (rev 14571)
@@ -1189,6 +1189,16 @@
         return self._home
 
 
+    def serialize(self):
+        """
+        Override to map one column specific to this class.
+        """
+        data = super(Calendar, self).serialize()
+        if data["metadataData"]["trashed"]:
+            data["metadataData"]["trashed"] = data["metadataData"]["trashed"].isoformat(" ")
+        return data
+
+
     @inlineCallbacks
     def copyMetadata(self, other):
         """

Modified: CalendarServer/trunk/txdav/common/datastore/podding/store_api.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/podding/store_api.py	2015-03-12 01:39:48 UTC (rev 14570)
+++ CalendarServer/trunk/txdav/common/datastore/podding/store_api.py	2015-03-12 02:51:01 UTC (rev 14571)
@@ -21,6 +21,7 @@
 from txdav.common.datastore.sql_tables import _HOME_STATUS_DISABLED
 
 from twistedcaldav.caldavxml import TimeRange
+from datetime import datetime
 
 
 class StoreAPIConduitMixin(object):
@@ -157,6 +158,16 @@
         """
         return dict([(k, UtilityConduitMixin._to_serialize_list(v),) for k, v in value.items()])
 
+
+    @staticmethod
+    def _to_serialize_search_value(value):
+        """
+        Convert the value to the external (JSON-based) representation.
+        """
+        def _convert(item):
+            return map(lambda x: x.isoformat(" ") if isinstance(x, datetime) else x, item)
+        return map(_convert, value)
+
 # These are the actions on store objects we need to expose via the conduit api
 
 # Calls on L{CommonHome} objects
@@ -173,7 +184,7 @@
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_moveaway", "moveObjectResourceAway")
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_synctokenrevision", "syncTokenRevision")
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_resourcenamessincerevision", "resourceNamesSinceRevision", transform_send_result=UtilityConduitMixin._to_tuple)
-UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_search", "search")
+UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_search", "search", transform_recv_result=StoreAPIConduitMixin._to_serialize_search_value)
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_sharing_records", "sharingBindRecords", transform_recv_result=StoreAPIConduitMixin._to_serialize_dict_value)
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_migrate_sharing_records", "migrateBindRecords")
 UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_group_sharees", "groupSharees", transform_recv_result=StoreAPIConduitMixin._to_serialize_dict_list_serialized_value)

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2015-03-12 01:39:48 UTC (rev 14570)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2015-03-12 02:51:01 UTC (rev 14571)
@@ -4756,6 +4756,8 @@
         the attributes may not match exactly and will need to be processed accordingly.
         """
         data = dict([(attr[1:], getattr(self, attr, None)) for attr in itertools.chain(self._rowAttributes(), self._otherSerializedAttributes())])
+        if data["trashed"]:
+            data["trashed"] = data["trashed"].isoformat(" ")
         data["created"] = data["created"].isoformat(" ")
         data["modified"] = data["modified"].isoformat(" ")
         return data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150311/adc522bb/attachment-0001.html>


More information about the calendarserver-changes mailing list