[Zodb-checkins] SVN: ZODB/branches/patricks-blob-dir-perm/src/ZODB/config.py Get blobstorage config working
Patrick Strawderman
cvs-admin at zope.org
Wed Oct 17 17:27:11 UTC 2012
Log message for revision 128034:
Get blobstorage config working
Changed:
U ZODB/branches/patricks-blob-dir-perm/src/ZODB/config.py
-=-
Modified: ZODB/branches/patricks-blob-dir-perm/src/ZODB/config.py
===================================================================
--- ZODB/branches/patricks-blob-dir-perm/src/ZODB/config.py 2012-10-17 17:08:30 UTC (rev 128033)
+++ ZODB/branches/patricks-blob-dir-perm/src/ZODB/config.py 2012-10-17 17:27:07 UTC (rev 128034)
@@ -151,6 +151,18 @@
from ZODB.DemoStorage import DemoStorage
return DemoStorage(self.config.name, base=base, changes=changes)
+def convert_permissions(config):
+ # We perform the conversion of the blob dir permissions here,
+ # as ZConfig currently does not provide a sufficient data type
+ permissions = getattr(config, "blob_dir_permissions", None)
+ if permissions is not None:
+ try:
+ return int(permissions, 8)
+ except ValueError:
+ raise ValueError(
+ "Expected an octal for blob_dir_permissions option, "
+ "got: %r" % (permissions,))
+
class FileStorage(BaseConfig):
def open(self):
@@ -173,16 +185,7 @@
v = getattr(config, name, self)
if v is not self:
options[name] = v
- # We perform the conversion of the blob dir permissions here,
- # as ZConfig currently does not provide a sufficient data type
- permissions = getattr(config, "blob_dir_permissions", None)
- if permissions is not None:
- try:
- options["blob_dir_permissions"] = int(permissions, 8)
- except ValueError:
- raise ValueError(
- "Expected an octal for blob_dir_permissions option, "
- "got: %r" % (permissions,))
+ options["blob_dir_permissions"] = convert_permissions(config)
return FileStorage(config.path, **options)
class BlobStorage(BaseConfig):
@@ -190,7 +193,8 @@
def open(self):
from ZODB.blob import BlobStorage
base = self.config.base.open()
- return BlobStorage(self.config.blob_dir, base)
+ return BlobStorage(self.config.blob_dir, base,
+ permissions=convert_permissions(self.config))
class ZEOClient(BaseConfig):
More information about the Zodb-checkins
mailing list