[CalendarServer-changes] [7773] CalendarServer/trunk/txdav/base/propertystore

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 11 17:40:30 PDT 2011


Revision: 7773
          http://trac.macosforge.org/projects/calendarserver/changeset/7773
Author:   glyph at apple.com
Date:     2011-07-11 17:40:30 -0700 (Mon, 11 Jul 2011)
Log Message:
-----------
Be more forgiving about missing xattr files.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/base/propertystore/appledouble_xattr.py
    CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py

Modified: CalendarServer/trunk/txdav/base/propertystore/appledouble_xattr.py
===================================================================
--- CalendarServer/trunk/txdav/base/propertystore/appledouble_xattr.py	2011-07-11 22:29:30 UTC (rev 7772)
+++ CalendarServer/trunk/txdav/base/propertystore/appledouble_xattr.py	2011-07-12 00:40:30 UTC (rev 7773)
@@ -183,6 +183,10 @@
 
     @property
     def attrs(self):
-        return attrsFromFile(self.path.sibling("._"+self.path.basename()).open())
+        try:
+            return attrsFromFile(self.path.sibling("._"+self.path.basename()).open())
+        except IOError:
+            return {}
 
 
+

Modified: CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py
===================================================================
--- CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py	2011-07-11 22:29:30 UTC (rev 7772)
+++ CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py	2011-07-12 00:40:30 UTC (rev 7773)
@@ -119,3 +119,16 @@
                          GETContentType("text/example"))
 
 
+    def test_propertyFreeFile(self):
+        """
+        Not all files have extended attributes or the associated AppleDouble
+        file.  Make sure that retrieving the 'attrs' attribute yields an empty
+        dictionary in that case.
+        """
+        sample = FilePath(self.mktemp())
+        sample.setContent("")
+        props = PropertyStore("nobody", lambda : sample)
+        self.assertEqual(props.attrs, {})
+
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110711/26adffab/attachment.html>


More information about the calendarserver-changes mailing list