[Zodb-checkins] SVN: ZODB/branches/jim-transform-wrapping/src/ZODB/ checkpoint

Jim Fulton jim at zope.com
Mon May 17 17:43:56 EDT 2010


Log message for revision 112433:
  checkpoint

Changed:
  U   ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py
  U   ZODB/branches/jim-transform-wrapping/src/ZODB/utils.py

-=-
Modified: ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py	2010-05-17 21:32:33 UTC (rev 112432)
+++ ZODB/branches/jim-transform-wrapping/src/ZODB/tests/hexstorage.py	2010-05-17 21:43:55 UTC (rev 112433)
@@ -46,22 +46,22 @@
 
     def load(self, oid, version=''):
         data, serial = self.base.load(oid, version)
-        return data.decode('hex'), serial
+        return data[2:].decode('hex'), serial
 
     def loadBefore(self, oid, tid):
         r = self.base.loadBefore(oid, tid)
         if r is not None:
             data, serial, after = r
-            return data.decode('hex'), serial, after
+            return data[2:].decode('hex'), serial, after
         else:
             return r
 
     def loadSerial(self, oid, serial):
-        return self.base.loadSerial(oid, serial).decode('hex')
+        return self.base.loadSerial(oid, serial)[2:].decode('hex')
 
     def pack(self, pack_time, referencesf, gc=True):
         def refs(p, oids=None):
-            return referencesf(p.decode('hex'), oids)
+            return referencesf(p[2:].decode('hex'), oids)
         return self.base.pack(pack_time, refs, gc)
 
     def registerDB(self, db):
@@ -73,11 +73,11 @@
 
     def store(self, oid, serial, data, version, transaction):
         return self.base.store(
-            oid, serial, data.encode('hex'), version, transaction)
+            oid, serial, '.h'+data.encode('hex'), version, transaction)
 
     def restore(self, oid, serial, data, version, prev_txn, transaction):
         return self.base.restore(
-            oid, serial, data and data.encode('hex'), version, prev_txn,
+            oid, serial, data and ('.h'+data.encode('hex')), version, prev_txn,
             transaction)
 
     def iterator(self, start=None, stop=None):
@@ -86,12 +86,13 @@
 
     def storeBlob(self, oid, oldserial, data, blobfilename, version,
                   transaction):
-        return self.base.storeBlob(oid, oldserial, data.encode('hex'),
+        return self.base.storeBlob(oid, oldserial, '.h'+data.encode('hex'),
                                    blobfilename, version, transaction)
 
     def restoreBlob(self, oid, serial, data, blobfilename, prev_txn,
                     transaction):
-        return self.base.restoreBlob(oid, serial, data and data.encode('hex'),
+        return self.base.restoreBlob(oid, serial,
+                                     data and ('.h'+data.encode('hex')),
                                      blobfilename, prev_txn, transaction)
 
     def invalidateCache(self):
@@ -101,17 +102,17 @@
         return self.db.invalidate(transaction_id, oids, version)
 
     def references(self, record, oids=None):
-        return self.db.references(record.decode('hex'), oids)
+        return self.db.references(record[2:].decode('hex'), oids)
 
     def transform_record_data(self, data):
-        return self._db_transform(data).encode('hex')
+        return '.h'+self._db_transform(data).encode('hex')
 
     def untransform_record_data(self, data):
-        return self._db_untransform(data.decode('hex'))
+        return self._db_untransform(data[2:].decode('hex'))
 
     def record_iternext(self, next=None):
         oid, tid, data, next = self.base.record_iternext(next)
-        return oid, tid, data.decode('hex'), next
+        return oid, tid, data[2:].decode('hex'), next
 
     def copyTransactionsFrom(self, other):
         ZODB.blob.copyTransactionsFromTo(other, self)

Modified: ZODB/branches/jim-transform-wrapping/src/ZODB/utils.py
===================================================================
--- ZODB/branches/jim-transform-wrapping/src/ZODB/utils.py	2010-05-17 21:32:33 UTC (rev 112432)
+++ ZODB/branches/jim-transform-wrapping/src/ZODB/utils.py	2010-05-17 21:43:55 UTC (rev 112433)
@@ -87,10 +87,10 @@
 
 def cp(f1, f2, length=None):
     """Copy all data from one file to another.
-    
+
     It copies the data from the current position of the input file (f1)
-    appending it to the current position of the output file (f2). 
-    
+    appending it to the current position of the output file (f2).
+
     It copies at most 'length' bytes. If 'length' isn't given, it copies
     until the end of the input file.
     """
@@ -103,7 +103,7 @@
         f1.seek(0,2)
         length = f1.tell()
         f1.seek(old_pos)
-    
+
     while length > 0:
         if n > length:
             n = length
@@ -206,7 +206,6 @@
     try:
         class_info = u.load()
     except Exception, err:
-        print "Error", err
         return '', ''
     if isinstance(class_info, tuple):
         if isinstance(class_info[0], tuple):
@@ -251,7 +250,7 @@
                     raise AssertionError(
                         "Failed precondition: ",
                         precondition.__doc__.strip())
-            
+
             return func(*args, **kw)
         finally:
             inst._lock_release()
@@ -269,4 +268,4 @@
 
     def __call__(self, func):
         return Locked(func, preconditions=self.preconditions)
-        
+



More information about the Zodb-checkins mailing list