[CalendarServer-changes] [7765] CalendarServer/branches/users/glyph/xattrs-from-files/txdav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 11 15:02:53 PDT 2011


Revision: 7765
          http://trac.macosforge.org/projects/calendarserver/changeset/7765
Author:   glyph at apple.com
Date:     2011-07-11 15:02:53 -0700 (Mon, 11 Jul 2011)
Log Message:
-----------
indirect access to property store class through the home, so it can be customized.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/xattrs-from-files/txdav/caldav/datastore/file.py
    CalendarServer/branches/users/glyph/xattrs-from-files/txdav/common/datastore/file.py

Modified: CalendarServer/branches/users/glyph/xattrs-from-files/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/xattrs-from-files/txdav/caldav/datastore/file.py	2011-07-11 22:02:41 UTC (rev 7764)
+++ CalendarServer/branches/users/glyph/xattrs-from-files/txdav/caldav/datastore/file.py	2011-07-11 22:02:53 UTC (rev 7765)
@@ -36,8 +36,6 @@
 
 from twisted.python.failure import Failure
 
-from txdav.base.propertystore.xattr import PropertyStore
-
 from twext.python.vcomponent import VComponent
 from twext.web2.dav import davxml
 from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType
@@ -666,8 +664,10 @@
 
 
     def properties(self):
-        uid = self._calendarObject._parentCollection._home.uid()
-        return PropertyStore(uid, lambda: self._path)
+        home = self._calendarObject._parentCollection._home
+        uid = home.uid()
+        propStoreClass = home._dataStore._propertyStoreClass
+        return propStoreClass(uid, lambda: self._path)
 
 
     def store(self, contentType):

Modified: CalendarServer/branches/users/glyph/xattrs-from-files/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/xattrs-from-files/txdav/common/datastore/file.py	2011-07-11 22:02:41 UTC (rev 7764)
+++ CalendarServer/branches/users/glyph/xattrs-from-files/txdav/common/datastore/file.py	2011-07-11 22:02:53 UTC (rev 7765)
@@ -50,7 +50,7 @@
 
 from txdav.base.propertystore.base import PropertyName
 from txdav.base.propertystore.none import PropertyStore as NonePropertyStore
-from txdav.base.propertystore.xattr import PropertyStore
+from txdav.base.propertystore.xattr import PropertyStore as XattrPropertyStore
 
 from errno import EEXIST, ENOENT
 from zope.interface import implements, directlyProvides
@@ -102,6 +102,7 @@
         self.enableAddressBooks = enableAddressBooks
         self._notifierFactory = notifierFactory
         self._transactionClass = CommonStoreTransaction
+        self._propertyStoreClass = XattrPropertyStore
         self.quota = quota
 
 
@@ -488,7 +489,9 @@
         # FIXME: needs tests for actual functionality
         # FIXME: needs to be cached
         # FIXME: transaction tests
-        props = PropertyStore(self.uid(), lambda : self._path)
+        props = self._dataStore._propertyStoreClass(
+            self.uid(), lambda : self._path
+        )
         self._transaction.addOperation(props.flush, "flush home properties")
         return props
 
@@ -840,7 +843,8 @@
     def properties(self):
         # FIXME: needs direct tests - only covered by store tests
         # FIXME: transactions
-        props = PropertyStore(self._home.uid(), lambda: self._path)
+        propStoreClass = self._home._dataStore._propertyStoreClass
+        props = propStoreClass(self._home.uid(), lambda: self._path)
         self.initPropertyStore(props)
 
         self._transaction.addOperation(props.flush,
@@ -933,8 +937,13 @@
 
     @cached
     def properties(self):
-        uid = self._parentCollection._home.uid()
-        props = PropertyStore(uid, lambda : self._path) if self._parentCollection.objectResourcesHaveProperties() else NonePropertyStore(uid)
+        home = self._parentCollection._home
+        uid = home.uid()
+        if self._parentCollection.objectResourcesHaveProperties():
+            propStoreClass = home._dataStore._propertyStoreClass
+            props = propStoreClass(uid, lambda : self._path)
+        else:
+            props = NonePropertyStore(uid)
         self.initPropertyStore(props)
         self._transaction.addOperation(props.flush, "object properties flush")
         return props
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110711/ac0f3338/attachment-0001.html>


More information about the calendarserver-changes mailing list