[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ Added blob-dir configuration option.

Jim Fulton jim at zope.com
Tue Dec 16 18:35:29 EST 2008


Log message for revision 94135:
  Added blob-dir configuration option.
  

Changed:
  U   ZODB/trunk/src/ZODB/FileStorage/zconfig.txt
  U   ZODB/trunk/src/ZODB/component.xml
  U   ZODB/trunk/src/ZODB/config.py

-=-
Modified: ZODB/trunk/src/ZODB/FileStorage/zconfig.txt
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/zconfig.txt	2008-12-16 22:08:09 UTC (rev 94134)
+++ ZODB/trunk/src/ZODB/FileStorage/zconfig.txt	2008-12-16 23:35:28 UTC (rev 94135)
@@ -2,8 +2,8 @@
 ===================================
 
 ZODB provides support for defining many storages, including
-FileStorages, using ZConfig.  To do this, you use a filestorage
-section, and define a path:
+FileStorages, using ZConfig.  To define a FileStorage, you use a
+filestorage section, and define a path:
 
     >>> import ZODB.config
     >>> fs = ZODB.config.storageFromString("""
@@ -15,16 +15,39 @@
     >>> fs._file.name
     'my.fs'
 
+    >>> fs.close()
 
 There are a number of options we can provide:
 
+blob-dir
+    If supplied, the file storage will provide blob support and this
+    is the name of a directory to hold blob data.  The directory will
+    be created if it doeesn't exist.  If no value (or an empty value)
+    is provided, then no blob support will be provided. (You can still
+    use a BlobStorage to provide blob support.)
+
+    >>> fs = ZODB.config.storageFromString("""
+    ... <filestorage>
+    ...     path my.fs
+    ...     blob-dir blobs
+    ... </filestorage>
+    ... """)
+
+    >>> fs._file.name
+    'my.fs'
+    >>> import os
+    >>> os.path.basename(fs.blob_dir)
+    'blobs'
+
+    >>> fs.close()
+
 create
     Flag that indicates whether the storage should be truncated if
     it already exists.
 
     To demonstrate this, we'll first write some dataL
 
-    >>> db = ZODB.DB(fs) # writes object 0
+    >>> db = ZODB.DB('my.fs') # writes object 0
     >>> db.close()
 
     Then reopen with the create option:

Modified: ZODB/trunk/src/ZODB/component.xml
===================================================================
--- ZODB/trunk/src/ZODB/component.xml	2008-12-16 22:08:09 UTC (rev 94134)
+++ ZODB/trunk/src/ZODB/component.xml	2008-12-16 23:35:28 UTC (rev 94135)
@@ -7,13 +7,22 @@
 
   <sectiontype name="filestorage" datatype=".FileStorage"
                implements="ZODB.storage">
-    <key name="path" required="yes">
+    <key name="path" required="yes" datatype="existing-dirpath">
       <description>
         Path name to the main storage file.  The names for
         supplemental files, including index and lock files, will be
         computed from this.
       </description>
     </key>
+    <key name="blob-dir" required="no" datatype="existing-dirpath">
+      <description>
+        If supplied, the file storage will provide blob support and this
+        is the name of a directory to hold blob data.  The directory will
+        be created if it doeesn't exist.  If no value (or an empty value)
+        is provided, then no blob support will be provided. (You can still
+        use a BlobStorage to provide blob support.)
+      </description>
+    </key>
     <key name="create" datatype="boolean" default="false">
       <description>
         Flag that indicates whether the storage should be truncated if

Modified: ZODB/trunk/src/ZODB/config.py
===================================================================
--- ZODB/trunk/src/ZODB/config.py	2008-12-16 22:08:09 UTC (rev 94134)
+++ ZODB/trunk/src/ZODB/config.py	2008-12-16 23:35:28 UTC (rev 94135)
@@ -147,6 +147,7 @@
                            read_only=self.config.read_only,
                            quota=self.config.quota,
                            pack_gc=self.config.pack_gc,
+                           blob_dir=self.config.blob_dir,
                            **options)
 
 class BlobStorage(BaseConfig):



More information about the Zodb-checkins mailing list