[CalendarServer-changes] [2637] CalendarServer/branches/sqlpropstore-2629/twistedcaldav/config.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 27 16:52:23 PDT 2008
Revision: 2637
http://trac.macosforge.org/projects/calendarserver/changeset/2637
Author: wsanchez at apple.com
Date: 2008-06-27 16:52:23 -0700 (Fri, 27 Jun 2008)
Log Message:
-----------
Add config option for property store, default to xattr
Modified Paths:
--------------
CalendarServer/branches/sqlpropstore-2629/twistedcaldav/config.py
Modified: CalendarServer/branches/sqlpropstore-2629/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/sqlpropstore-2629/twistedcaldav/config.py 2008-06-27 20:40:51 UTC (rev 2636)
+++ CalendarServer/branches/sqlpropstore-2629/twistedcaldav/config.py 2008-06-27 23:52:23 UTC (rev 2637)
@@ -71,6 +71,7 @@
"DocumentRoot" : "/Library/CalendarServer/Documents",
"UserQuota" : 104857600, # User quota (in bytes)
"MaximumAttachmentSize": 1048576, # Attachment size limit (in bytes)
+ "PropertyStore" : "xattr",
#
# Directory service
@@ -237,16 +238,13 @@
self.setDefaults(defaults)
self._data = copy.deepcopy(self._defaults)
self._configFile = None
+ self.updateLogLevels()
+ self.updatePropertyStore()
- from twistedcaldav.sqlprops import sqlPropertyStore
- self.PropertyStoreClass = sqlPropertyStore
- #from twistedcaldav.extensions import CachingXattrPropertyStore
- #self.PropertyStoreClass = CachingXattrPropertyStore
-
def __str__(self):
return str(self._data)
- def update(self, items):
+ def update(self, items={}):
#
# Special handling for directory services configs
#
@@ -299,7 +297,7 @@
davxml.Protected(),
TwistedACLInheritable(),
)
- for principal in config.AdminPrincipals
+ for principal in self.AdminPrincipals
)
self.ReadACEs = tuple(
@@ -312,7 +310,7 @@
davxml.Protected(),
TwistedACLInheritable(),
)
- for principal in config.ReadPrincipals
+ for principal in self.ReadPrincipals
)
self.RootResourceACL = davxml.ACL(
@@ -340,7 +338,7 @@
),
davxml.Protected(),
)
- for principal in config.AdminPrincipals
+ for principal in self.AdminPrincipals
]
)
@@ -352,8 +350,16 @@
from twistedcaldav.resource import CalendarPrincipalResource
CalendarPrincipalResource.enableDropBox(self.EnableDropBox)
+ #
+ # Update logging
+ #
self.updateLogLevels()
+ #
+ # Handle DAV property store settings
+ #
+ self.updatePropertyStore()
+
def updateLogLevels(self):
clearLogLevels()
@@ -371,6 +377,21 @@
except InvalidLogLevelError, e:
raise ConfigurationError("Invalid log level: %s" % (e.level))
+ def updatePropertyStore(self):
+ #
+ # FIXME: Use introspection
+ #
+ if self.PropertyStore == "xattr":
+ log.info("Using xattr backing for WebDAV properties.")
+ from twistedcaldav.extensions import CachingXattrPropertyStore
+ self.PropertyStoreClass = CachingXattrPropertyStore
+ elif self.PropertyStore == "SQL":
+ log.info("Using SQL backing for WebDAV properties.")
+ from twistedcaldav.sqlprops import sqlPropertyStore
+ self.PropertyStoreClass = sqlPropertyStore
+ else:
+ raise ConfigurationError("Invalid PropertyStore: %s" % (self.PropertyStore,))
+
def updateDefaults(self, items):
_mergeData(self._defaults, items)
self.update(items)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080627/b892813e/attachment.html
More information about the calendarserver-changes
mailing list