[CalendarServer-changes] [6021] CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore /postgres.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 9 14:43:11 PDT 2010


Revision: 6021
          http://trac.macosforge.org/projects/calendarserver/changeset/6021
Author:   glyph at apple.com
Date:     2010-08-09 14:43:08 -0700 (Mon, 09 Aug 2010)
Log Message:
-----------
stub out a few things while I'm working on them, so the server starts up and is happy

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py

Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py	2010-08-09 21:29:17 UTC (rev 6020)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py	2010-08-09 21:43:08 UTC (rev 6021)
@@ -593,6 +593,13 @@
         return True
 
 
+    def resourceUIDForName(self, name):
+        obj = self.calendar.calendarObjectWithName(name)
+        if obj is None:
+            return None
+        return obj.uid()
+
+
     def resourceNameForUID(self, uid):
         obj = self.calendar.calendarObjectWithUID(uid)
         if obj is None:
@@ -604,10 +611,11 @@
         pass
 
 
-    def indexedSearch(self, filter, userid='', fbtype=False):
+    def indexedSearch(self, filter, useruid='', fbtype=False):
         return []
 
 
+
 class PostgresCalendar(object):
 
     implements(ICalendar)
@@ -658,14 +666,18 @@
         return self._home
 
 
-    def calendarObjects(self):
+    def listCalendarObjects(self):
+        # FIXME: see listChildren
         rows = self._txn.execSQL(
             "select RESOURCE_NAME from "
             "CALENDAR_OBJECT where "
             "CALENDAR_RESOURCE_ID = %s",
             [self._resourceID])
-        for row in rows:
-            name = row[0]
+        return [row[0] for row in rows]
+
+
+    def calendarObjects(self):
+        for name in self.listCalendarObjects():
             yield self.calendarObjectWithName(name)
 
 
@@ -992,6 +1004,57 @@
 
 
 
+class PostgresNotificationsCollection(object):
+
+
+    def __init__(self, txn, uid):
+        self._txn = txn
+        self._uid = uid
+        self._resourceID = 'notifications for %s' % (uid,)
+
+
+    def name(self):
+        return 'notification'
+
+
+    def notificationObjects(self):
+        return []
+
+
+    def notificationObjectWithName(self, name):
+        return None
+
+    def notificationObjectWithUID(self, uid):
+        return None
+
+
+    def writeNotificationObject(self, uid, xmltype, xmldata):
+        return None
+
+
+    def removeNotificationObjectWithName(self, name):
+        return
+
+
+    def removeNotificationObjectWithUID(self, uid):
+        return
+
+
+    def syncToken(self):
+        return 'dummy-sync-token'
+
+    def notificationObjectsSinceToken(self, token):
+        changed = []
+        removed = []
+        token = self.syncToken()
+        return (changed, removed, token)
+
+
+    def properties(self):
+        return PropertyStore(self._uid, self._uid, self._txn, self._resourceID)
+
+
+
 class PostgresCalendarTransaction(object):
     """
     Transaction implementation for postgres database.
@@ -1059,7 +1122,7 @@
         """
         Implement notificationsWithUID.
         """
-        raise NotImplementedError("no notifications collection yet")
+        return PostgresNotificationsCollection(self, uid)
 
 
     def abort(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100809/fe455472/attachment.html>


More information about the calendarserver-changes mailing list