[Zodb-checkins] SVN: ZODB/branches/blob-merge-branch/src/Z -
removed some unnecessary XXX comments
Christian Theune
ct at gocept.com
Mon Feb 27 12:37:42 EST 2006
Log message for revision 65524:
- removed some unnecessary XXX comments
- made ClientStorage and BlobStorage create the blob root directories automatically
Changed:
U ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py
U ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py
-=-
Modified: ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py 2006-02-27 17:35:32 UTC (rev 65523)
+++ ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py 2006-02-27 17:37:42 UTC (rev 65524)
@@ -315,9 +315,15 @@
self._lock = threading.Lock()
# XXX need to check for POSIX-ness here
- if blob_dir is not None and (os.stat(blob_dir).st_mode & 077) != 0:
- log2('Blob dir %s has insecure mode setting' % blob_dir,
- level=logging.WARNING)
+ if blob_dir is not None:
+ if not os.path.exists(blob_dir):
+ os.makedirs(blob_dir, 0700)
+ log2("Blob cache directory '%s' does not exist. "
+ "Created new directory." % self.base_directory,
+ level=logging.INFO)
+ if (os.stat(blob_dir).st_mode & 077) != 0:
+ log2('Blob dir %s has insecure mode setting' % blob_dir,
+ level=logging.WARNING)
self.blob_dir = blob_dir
Modified: ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py 2006-02-27 17:35:32 UTC (rev 65523)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py 2006-02-27 17:37:42 UTC (rev 65524)
@@ -15,6 +15,7 @@
import os
import shutil
import base64
+import logging
from zope.interface import implements
from zope.proxy import ProxyBase, getProxiedObject
@@ -25,6 +26,8 @@
BLOB_SUFFIX = ".blob"
+logger = logging.getLogger('ZODB.BlobStorage')
+
class BlobStorage(ProxyBase):
"""A storage to support blobs."""
@@ -32,7 +35,7 @@
__slots__ = ('base_directory', 'dirty_oids')
# Proxies can't have a __dict__ so specifying __slots__ here allows
- # us to have instance attributes? XXX confirm
+ # us to have instance attributes explicitly on the proxy.
def __new__(self, base_directory, storage):
return ProxyBase.__new__(self, storage)
@@ -41,6 +44,10 @@
# TODO Complain if storage is ClientStorage
ProxyBase.__init__(self, storage)
self.base_directory = base_directory
+ if not os.path.exists(self.base_directory):
+ os.makedirs(self.base_directory, 0700)
+ logger.info("Blob directory '%s' does not exist. "
+ "Created new directory." % self.base_directory)
self.dirty_oids = []
def __repr__(self):
@@ -93,7 +100,6 @@
""" We need to override the base storage's abort instead of
providing an _abort method because methods found on the proxied object
aren't rebound to the proxy """
- # XXX this is never called during our tests.
getProxiedObject(self).tpc_abort(*arg, **kw)
while self.dirty_oids:
oid, serial = self.dirty_oids.pop()
More information about the Zodb-checkins
mailing list