[CalendarServer-changes] [2487] CalendarServer/trunk/twistedcaldav/extensions.py

source_changes at macosforge.org source_changes at macosforge.org
Fri May 23 23:50:44 PDT 2008


Revision: 2487
          http://trac.macosforge.org/projects/calendarserver/changeset/2487
Author:   wsanchez at apple.com
Date:     2008-05-23 23:50:43 -0700 (Fri, 23 May 2008)

Log Message:
-----------
Don't puke if we try to delete an uncached thing from the cache

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/extensions.py

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2008-05-24 06:00:00 UTC (rev 2486)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2008-05-24 06:50:43 UTC (rev 2487)
@@ -740,14 +740,14 @@
     """
     A Property Store that caches attributes from the xattrs.
     """
-
     def __init__(self, resource):
         self._cache = {}
         self._not_found = {}
         super(CachingXattrPropertyStore, self).__init__(resource)
 
+    def get(self, qname):
+        log.debug("Get: %r, %r" % (self.resource.fp.path, qname))
 
-    def get(self, qname):
         if qname in self._cache:
             log.debug("Cache hit: %r, %r, %r" % (self, self.resource.fp.path, qname))
             return self._cache[qname]
@@ -770,6 +770,8 @@
 
 
     def set(self, property):
+        log.debug("Set: %r, %r" % (self.resource.fp.path, property))
+
         super(CachingXattrPropertyStore, self).set(property)
         log.debug("Updating cache: %r, %r, %r" % (self, self.resource.fp.path, property.qname()))
         self._cache[property.qname()] = property
@@ -779,6 +781,8 @@
 
 
     def contains(self, qname):
+        log.debug("Contains: %r, %r" % (self.resource.fp.path, qname))
+
         if qname in self._cache:
             log.debug("Contains cache hit: %r, %r, %r" % (self, self.resource.fp.path, qname))
             return True
@@ -803,9 +807,13 @@
 
 
     def delete(self, qname):
-        del self._not_found[qname]
-        del self._cache[qname]
+        log.debug("Deleting: %r, %r" % (self.resource.fp.path, qname))
 
+        if qname in self._not_found:
+            del self._not_found[qname]
+        if qname in self._cache:
+            del self._cache[qname]
+
         super(CachingXattrPropertyStore, self).delete(qname)
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080523/b3453416/attachment-0001.htm 


More information about the calendarserver-changes mailing list