[CalendarServer-changes] [5377] CalendarServer/trunk/txdav/propertystore/xattr.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 22 16:41:51 PDT 2010


Revision: 5377
          http://trac.macosforge.org/projects/calendarserver/changeset/5377
Author:   wsanchez at apple.com
Date:     2010-03-22 16:41:50 -0700 (Mon, 22 Mar 2010)
Log Message:
-----------
RaiseKeyError in __delitem__ if key is neither in the cache nor in the backing store.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/propertystore/xattr.py

Modified: CalendarServer/trunk/txdav/propertystore/xattr.py
===================================================================
--- CalendarServer/trunk/txdav/propertystore/xattr.py	2010-03-22 23:40:50 UTC (rev 5376)
+++ CalendarServer/trunk/txdav/propertystore/xattr.py	2010-03-22 23:41:50 UTC (rev 5377)
@@ -29,12 +29,8 @@
 import urllib
 from zlib import compress, decompress, error as ZlibError
 from cPickle import UnpicklingError, loads as unpickle
+from xattr import xattr
 
-import xattr
-
-if getattr(xattr, "xattr", None) is None:
-    raise ImportError("wrong xattr package imported")
-
 from twext.web2.dav.davxml import WebDAVDocument
 
 from txdav.propertystore.base import AbstractPropertyStore, PropertyName
@@ -88,7 +84,7 @@
 
     def __init__(self, path):
         self.path = path
-        self.attrs = xattr.xattr(path.path)
+        self.attrs = xattr(path.path)
         self.removed = set()
         self.modified = {}
 
@@ -102,6 +98,9 @@
     def __delitem__(self, key):
         if key in self.modified:
             del self.modified[key]
+        elif self._encodeKey(key) not in self.attrs:
+            raise KeyError(key)
+
         self.removed.add(key)
 
     def __getitem__(self, key):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100322/f9716308/attachment-0001.html>


More information about the calendarserver-changes mailing list