Commit 41c20bde authored by Dmitry Vasiliev's avatar Dmitry Vasiliev

Now use ZODB.utils.z64 instead of '\0\0\0\0\0\0\0\0' where appropriate

parent 402ea2f9
......@@ -25,6 +25,7 @@ import POSException
from persistent.TimeStamp import TimeStamp
from ZODB import POSException, utils
from ZODB.utils import z64
from ZODB.UndoLogCompatible import UndoLogCompatible
log = logging.getLogger("ZODB.BaseStorage")
......@@ -98,7 +99,7 @@ class BaseStorage(UndoLogCompatible):
t=self._ts=apply(TimeStamp,(time.gmtime(t)[:5]+(t%60,)))
self._tid = `t`
if base is None:
self._oid='\0\0\0\0\0\0\0\0'
self._oid=z64
else:
self._oid=base._oid
......
......@@ -22,6 +22,7 @@ import warnings
import logging
from ZODB.broken import find_global
from ZODB.utils import z64
from ZODB.Connection import Connection
from ZODB.serialize import referencesf
......@@ -124,7 +125,7 @@ class DB(object):
if not hasattr(storage,'tpc_vote'):
storage.tpc_vote = lambda *args: None
try:
storage.load('\0\0\0\0\0\0\0\0','')
storage.load(z64,'')
except KeyError:
# Create the database's root in the storage if it doesn't exist
from persistent.mapping import PersistentMapping
......@@ -138,7 +139,7 @@ class DB(object):
t = transaction.Transaction()
t.description = 'initial database creation'
storage.tpc_begin(t)
storage.store('\0\0\0\0\0\0\0\0', None, file.getvalue(), '', t)
storage.store(z64, None, file.getvalue(), '', t)
storage.tpc_vote(t)
storage.tpc_finish(t)
......
......@@ -82,6 +82,7 @@ and call it to monitor the storage.
import base64, time, string
from ZODB import POSException, BaseStorage, utils
from ZODB.utils import z64
from persistent.TimeStamp import TimeStamp
from cPickle import loads
from BTrees import OOBTree
......@@ -409,7 +410,7 @@ class DemoStorage(BaseStorage.BaseStorage):
# Now build an index of *only* those objects reachable
# from the root.
rootl = ['\0\0\0\0\0\0\0\0']
rootl = [z64]
pindex = {}
while rootl:
oid = rootl.pop()
......
......@@ -21,7 +21,7 @@ It is meant to illustrate the simplest possible storage.
The Mapping storage uses a single data structure to map object ids to data.
"""
from ZODB import utils
from ZODB.utils import u64, z64
from ZODB import BaseStorage
from ZODB import POSException
from persistent.TimeStamp import TimeStamp
......@@ -115,7 +115,7 @@ class MappingStorage(BaseStorage.BaseStorage):
if not self._index:
return
# Build an index of *only* those objects reachable from the root.
rootl = ['\0\0\0\0\0\0\0\0']
rootl = [z64]
pindex = {}
while rootl:
oid = rootl.pop()
......@@ -144,6 +144,6 @@ class MappingStorage(BaseStorage.BaseStorage):
for oid in keys:
r = self._index[oid]
o.append(' %s: %s, %s' %
(utils.u64(oid),TimeStamp(r[:8]),`r[8:]`))
(u64(oid),TimeStamp(r[:8]),`r[8:]`))
return '\n'.join(o)
......@@ -19,6 +19,8 @@ objects like hit counters that don't need or want to participate
in undo or versions.
"""
from ZODB.utils import z64
from MappingStorage import MappingStorage
from BaseStorage import BaseStorage
import anydbm, os
......@@ -56,7 +58,7 @@ class gdbmStorage(anydbmStorage):
self._index=index=gdbm.open(filename, flag[:1]+'f', mode)
self._tindex=[]
m='\0\0\0\0\0\0\0\0'
m=z64
oid=index.firstkey()
while oid != None:
m=max(m, oid)
......@@ -76,7 +78,7 @@ class gdbmStorage(anydbmStorage):
# Build an index of *only* those objects reachable
# from the root.
index=self._index
rootl=['\0\0\0\0\0\0\0\0']
rootl=[z64]
pop=rootl.pop
pindex={}
referenced=pindex.has_key
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment