[Zodb-checkins] CVS: Packages/ZODB - component.xml:1.10.6.3.8.1 config.py:1.13.4.1.38.1

Jim Fulton jim at zope.com
Thu Jan 19 20:15:11 EST 2006


Update of /cvs-repository/Packages/ZODB
In directory cvs.zope.org:/tmp/cvs-serv24275/ZODB

Modified Files:
      Tag: jim-test-storage
	component.xml config.py 
Log Message:
First cut at as-of option to open to a specific point in time.


=== Packages/ZODB/component.xml 1.10.6.3 => 1.10.6.3.8.1 ===
--- Packages/ZODB/component.xml:1.10.6.3	Fri Nov 26 14:36:44 2004
+++ Packages/ZODB/component.xml	Thu Jan 19 20:15:09 2006
@@ -35,6 +35,13 @@
         raised.
       </description>
     </key>
+    <key name="as-of" datatype="string">
+      <description>
+        The as-of option allows opening a storage at a particilar 
+        time in it's history.  The argument is a date-time of the form:
+        YYYY-MM-DDTHH:MM:SS.
+      </description>
+    </key>
   </sectiontype>
 
   <sectiontype name="mappingstorage" datatype=".MappingStorage"


=== Packages/ZODB/config.py 1.13.4.1 => 1.13.4.1.38.1 ===
--- Packages/ZODB/config.py:1.13.4.1	Mon Sep 15 14:02:58 2003
+++ Packages/ZODB/config.py	Thu Jan 19 20:15:09 2006
@@ -17,6 +17,7 @@
 
 import os
 from cStringIO import StringIO
+import ZODB.Timestamp
 
 import ZConfig
 
@@ -122,10 +123,25 @@
 
     def open(self):
         from ZODB.FileStorage import FileStorage
+
+        as_of = self.config.as_of
+        if as_of:
+            if 'T' in as_of:
+                d, t = as_of.split('T')
+            else:
+                d, t = as_of, '0'
+
+            y, m, d = map(int, d.split('-'))
+            as_of = ZODB.TimeStamp.TimeStamp(y, m, d, *t.split(':'))
+        else:
+            as_of = None
+            
         return FileStorage(self.config.path,
                            create=self.config.create,
                            read_only=self.config.read_only,
-                           quota=self.config.quota)
+                           quota=self.config.quota,
+                           stop=as_of,
+                           )
 
 class ZEOClient(BaseConfig):
 



More information about the Zodb-checkins mailing list