[Zodb-checkins] CVS: ZODB3/ZODB/zodb4 - z4utils.py:1.1.2.2

Fred L. Drake, Jr. fred at zope.com
Thu Jan 29 16:29:27 EST 2004


Update of /cvs-repository/ZODB3/ZODB/zodb4
In directory cvs.zope.org:/tmp/cvs-serv24718

Modified Files:
      Tag: zope3-zodb3-devel-branch
	z4utils.py 
Log Message:
pull another helper function from ZODB4


=== ZODB3/ZODB/zodb4/z4utils.py 1.1.2.1 => 1.1.2.2 ===
--- ZODB3/ZODB/zodb4/z4utils.py:1.1.2.1	Wed Jan 28 08:04:47 2004
+++ ZODB3/ZODB/zodb4/z4utils.py	Thu Jan 29 16:29:26 2004
@@ -42,3 +42,17 @@
         write(d)
         l = l - len(d)
 
+
+# originally from zodb.storage.base
+
+def splitrefs(refstr, oidlen=8):
+    # refstr is a packed string of reference oids.  Always return a list of
+    # oid strings.  Most storages use fixed oid lengths of 8 bytes, but if
+    # the oids in refstr are a different size, use oidlen to specify.  This
+    # does /not/ support variable length oids in refstr.
+    if not refstr:
+        return []
+    num, extra = divmod(len(refstr), oidlen)
+    fmt = '%ds' % oidlen
+    assert extra == 0, refstr
+    return list(struct.unpack('>' + (fmt * num), refstr))




More information about the Zodb-checkins mailing list