[CalendarServer-changes] [6139] CalendarServer/trunk/txcaldav/calendarstore/postgres.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 19 15:47:02 PDT 2010
Revision: 6139
http://trac.macosforge.org/projects/calendarserver/changeset/6139
Author: glyph at apple.com
Date: 2010-08-19 15:47:01 -0700 (Thu, 19 Aug 2010)
Log Message:
-----------
memoize some stuff for the new notificationCollections() test.
Modified Paths:
--------------
CalendarServer/trunk/txcaldav/calendarstore/postgres.py
Modified: CalendarServer/trunk/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-19 22:26:32 UTC (rev 6138)
+++ CalendarServer/trunk/txcaldav/calendarstore/postgres.py 2010-08-19 22:47:01 UTC (rev 6139)
@@ -1885,6 +1885,7 @@
self._txn = txn
self._uid = uid
self._resourceID = resourceID
+ self._notifications = {}
def retrieveOldIndex(self):
@@ -1920,6 +1921,7 @@
return self.notificationObjectWithUID(self._nameToUID(name))
+ @memoized('uid', '_notifications')
def notificationObjectWithUID(self, uid):
rows = self._txn.execSQL(
"select RESOURCE_ID from NOTIFICATION where NOTIFICATION_UID = %s"
@@ -1940,6 +1942,7 @@
notificationObject = self.notificationObjectWithUID(uid)
notificationObject.properties()[PropertyName.fromElement(NotificationType)] = NotificationType(xmltype)
+
def removeNotificationObjectWithName(self, name):
self.removeNotificationObjectWithUID(self._nameToUID(name))
@@ -1981,7 +1984,9 @@
self._connection = connection
self._cursor = connection.cursor()
self._completed = False
- self._homes = {}
+ self._calendarHomes = {}
+ self._addressbookHomes = {}
+ self._notificationHomes = {}
self._postCommitOperations = []
self._notifierFactory = notifierFactory
self._label = label
@@ -2010,7 +2015,7 @@
self._connection.close()
- @memoized('uid', '_homes')
+ @memoized('uid', '_calendarHomes')
def calendarHomeWithUID(self, uid, create=False):
data = self.execSQL(
"select RESOURCE_ID from CALENDAR_HOME where OWNER_UID = %s",
@@ -2036,7 +2041,7 @@
return PostgresCalendarHome(self, uid, resid, notifier)
- @memoized('uid', '_homes')
+ @memoized('uid', '_addressbookHomes')
def addressbookHomeWithUID(self, uid, create=False):
data = self.execSQL(
"select RESOURCE_ID from ADDRESSBOOK_HOME where OWNER_UID = %s",
@@ -2062,6 +2067,7 @@
return PostgresAddressBookHome(self, uid, resid, notifier)
+ @memoized('uid', '_notificationHomes')
def notificationsWithUID(self, uid):
"""
Implement notificationsWithUID.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100819/026b6a11/attachment.html>
More information about the calendarserver-changes
mailing list