[Zodb-checkins] CVS: Zope/lib/python/ZODB - ActivityMonitor.py:1.3 BaseStorage.py:1.20 ConflictResolution.py:1.12 Connection.py:1.72 DB.py:1.43 DemoStorage.py:1.12 ExportImport.py:1.14 FileStorage.py:1.95 MappingStorage.py:1.7 Mount.py:1.16 POSException.py:1.12 PersistentList.py:1.3 PersistentMapping.py:1.20 TmpStore.py:1.7 Transaction.py:1.37 UndoLogCompatible.py:1.6 ZApplication.py:1.11 __init__.py:1.13 bpthread.py:1.5 conversionhack.py:1.4 dbmStorage.py:1.4 fsIndex.py:1.3 fsrecover.py:1.5 lock_file.py:1.6 referencesf.py:1.6 utils.py:1.12
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:07:41 -0400
Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv20265
Modified Files:
ActivityMonitor.py BaseStorage.py ConflictResolution.py
Connection.py DB.py DemoStorage.py ExportImport.py
FileStorage.py MappingStorage.py Mount.py POSException.py
PersistentList.py PersistentMapping.py TmpStore.py
Transaction.py UndoLogCompatible.py ZApplication.py
__init__.py bpthread.py conversionhack.py dbmStorage.py
fsIndex.py fsrecover.py lock_file.py referencesf.py utils.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/ZODB/ActivityMonitor.py 1.2 => 1.3 ===
--- Zope/lib/python/ZODB/ActivityMonitor.py:1.2 Mon Jun 10 16:20:44 2002
+++ Zope/lib/python/ZODB/ActivityMonitor.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""ZODB transfer activity monitoring
@@ -104,4 +104,3 @@
div['loads'] = div['loads'] + total_loads
return res
-
=== Zope/lib/python/ZODB/BaseStorage.py 1.19 => 1.20 ===
--- Zope/lib/python/ZODB/BaseStorage.py:1.19 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/BaseStorage.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Handy standard storage machinery
"""
@@ -30,7 +30,7 @@
_is_read_only = 0
def __init__(self, name, base=None):
-
+
self.__name__=name
# Allocate locks:
@@ -64,13 +64,13 @@
def getName(self):
return self.__name__
-
+
def getSize(self):
return len(self)*300 # WAG!
-
+
def history(self, oid, version, length=1):
pass
-
+
def modifiedInVersion(self, oid):
return ''
@@ -97,13 +97,13 @@
def isReadOnly(self):
return self._is_read_only
-
+
def supportsUndo(self):
return 0
-
+
def supportsVersions(self):
return 0
-
+
def tpc_abort(self, transaction):
self._lock_acquire()
try:
@@ -147,7 +147,7 @@
self._tstatus=status
self._begin(self._serial, user, desc, ext)
-
+
finally: self._lock_release()
def _begin(self, tid, u, d, e):
@@ -247,7 +247,7 @@
else:
restoring = 0
for transaction in other.iterator():
-
+
tid=transaction.tid
if _ts is None:
_ts=TimeStamp(tid)
@@ -265,7 +265,7 @@
ok=1
if verbose: print _ts
-
+
self.tpc_begin(transaction, tid, transaction.status)
for r in transaction:
oid=r.oid
@@ -276,7 +276,7 @@
pre=preget(oid, None)
s=self.store(oid, pre, r.data, r.version, transaction)
preindex[oid]=s
-
+
self.tpc_vote(transaction)
self.tpc_finish(transaction)
=== Zope/lib/python/ZODB/ConflictResolution.py 1.11 => 1.12 ===
--- Zope/lib/python/ZODB/ConflictResolution.py:1.11 Wed Aug 14 15:56:04 2002
+++ Zope/lib/python/ZODB/ConflictResolution.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
from cStringIO import StringIO
from cPickle import Unpickler, Pickler
=== Zope/lib/python/ZODB/Connection.py 1.71 => 1.72 ===
--- Zope/lib/python/ZODB/Connection.py:1.71 Fri Jun 14 16:25:06 2002
+++ Zope/lib/python/ZODB/Connection.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Database connection support
@@ -116,7 +116,7 @@
def __getitem__(self, oid, tt=type(())):
obj = self._cache.get(oid, None)
if obj is not None:
- return obj
+ return obj
__traceback_info__ = (oid)
p, serial = self._storage.load(oid, self._version)
@@ -136,7 +136,7 @@
if type(klass) is tt:
module, name = klass
klass=self._db._classFactory(self, module, name)
-
+
if (args is None or
not args and not hasattr(klass,'__getinitargs__')):
object=klass.__basicnew__()
@@ -152,7 +152,7 @@
self._cache[oid] = object
if oid=='\0\0\0\0\0\0\0\0':
- self._root_=object # keep a ref
+ self._root_=object # keep a ref
return object
def _persistent_load(self,oid,
@@ -176,12 +176,12 @@
# Maybe their's more current data in the
# object's actual record!
return self[oid]
-
+
object=klass.__basicnew__()
object._p_oid=oid
object._p_jar=self
object._p_changed=None
-
+
self._cache[oid] = object
return object
@@ -230,13 +230,13 @@
def cacheFullSweep(self, dt=0):
self._cache.full_sweep(dt)
-
+
def cacheMinimize(self, dt=0):
# dt is ignored
self._cache.minimize()
__onCloseCallbacks = None
-
+
def onCloseCallback(self, f):
if self.__onCloseCallbacks is None:
self.__onCloseCallbacks = []
@@ -259,9 +259,9 @@
self._debug_info=()
# Return the connection to the pool.
db._closeConnection(self)
-
+
__onCommitActions = None
-
+
def onCommitAction(self, method_name, *args, **kw):
if self.__onCommitActions is None:
self.__onCommitActions = []
@@ -307,26 +307,26 @@
# stackup=stackup, new_oid=self.new_oid):
# if (not hasattr(object, '_p_oid') or
# type(object) is ClassType): return None
- #
+ #
# oid=object._p_oid
- #
+ #
# if oid is None or object._p_jar is not self:
# oid = self.new_oid()
# object._p_jar=self
# object._p_oid=oid
# stackup(object)
- #
+ #
# klass=object.__class__
- #
+ #
# if klass is ExtensionKlass: return oid
- #
+ #
# if hasattr(klass, '__getinitargs__'): return oid
- #
+ #
# module=getattr(klass,'__module__','')
# if module: klass=module, klass.__name__
- #
+ #
# return oid, klass
-
+
file=StringIO()
seek=file.seek
pickler=Pickler(file,1)
@@ -340,7 +340,7 @@
version=self._version
-
+
while stack:
object=stack[-1]
del stack[-1]
@@ -359,9 +359,9 @@
):
raise ConflictError(object=object)
self._invalidating.append(oid)
-
+
klass = object.__class__
-
+
if klass is ExtensionKlass:
# Yee Ha!
dict={}
@@ -375,12 +375,12 @@
len(args) # XXX Assert it's a sequence
else:
args = None # New no-constructor protocol!
-
+
module=getattr(klass,'__module__','')
if module: klass=module, klass.__name__
__traceback_info__=klass, oid, self._version
state=object.__getstate__()
-
+
seek(0)
clear_memo()
dump((klass,args))
@@ -409,12 +409,12 @@
LOG('ZODB', BLATHER,
'Commiting subtransaction of size %s' % src.getSize())
-
+
self._storage=tmp
self._tmp=None
tmp.tpc_begin(t)
-
+
load=src.load
store=tmp.store
dest=self._version
@@ -426,7 +426,7 @@
invalidating[len(invalidating):]=oids
creating=self._creating
creating[len(creating):]=src._creating
-
+
for oid in oids:
data, serial = load(oid, src)
s=store(oid, serial, data, dest, t)
@@ -464,7 +464,7 @@
def db(self): return self._db
def getVersion(self): return self._version
-
+
def invalidate(self, oid):
"""Invalidate a particular oid
@@ -575,21 +575,21 @@
file=StringIO(p)
unpickler=Unpickler(file)
unpickler.persistent_load=self._persistent_load
-
+
copy = unpickler.load()
-
+
klass, args = copy
-
+
if klass is not ExtensionKlass:
LOG('ZODB',ERROR,
"Unexpected klass when setting class state on %s"
% getattr(object,'__name__','(?)'))
return
-
+
copy=apply(klass,args)
object.__dict__.clear()
object.__dict__.update(copy.__dict__)
-
+
object._p_oid=oid
object._p_jar=self
object._p_changed=0
@@ -647,7 +647,7 @@
# update the _p_changed flag, because the subtransaction
# tpc_vote() calls already did this. The change=1 argument
# exists to allow commit_sub() to avoid setting the flag
- # again.
+ # again.
if not store_return:
return
if isinstance(store_return, StringType):
@@ -712,7 +712,7 @@
def getDebugInfo(self):
return self._debug_info
-
+
def setDebugInfo(self, *args):
self._debug_info = self._debug_info + args
@@ -737,9 +737,8 @@
new._p_changed=1
get_transaction().register(new)
self._cache[oid]=new
-
+
class tConnection(Connection):
def close(self):
self._breakcr()
-
=== Zope/lib/python/ZODB/DB.py 1.42 => 1.43 ===
--- Zope/lib/python/ZODB/DB.py:1.42 Mon Jun 10 16:20:44 2002
+++ Zope/lib/python/ZODB/DB.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Database objects
@@ -101,7 +101,7 @@
if hasattr(storage, 'undoInfo'):
self.undoInfo=storage.undoInfo
-
+
def _cacheMean(self, attr):
# XXX this method doesn't work
@@ -120,7 +120,7 @@
_silly=('__doc__',), _globals={}):
return getattr(__import__(location, _globals, _globals, _silly),
name)
-
+
def _closeConnection(self, connection):
"""Return a connection to the pool"""
self._a()
@@ -136,7 +136,7 @@
# Pool now usable again, unlock it.
pool_lock.release()
finally: self._r()
-
+
def _connectionMap(self, f):
self._a()
try:
@@ -171,7 +171,7 @@
detail[c] = detail[c] + 1
else:
detail[c] = 1
-
+
self._connectionMap(f)
detail = detail.items()
detail.sort()
@@ -194,7 +194,7 @@
module = getattr(ob.__class__, '__module__', '')
module = module and '%s.' % module or ''
-
+
detail.append({
'conn_no': cn,
'oid': oid,
@@ -252,10 +252,10 @@
def exportFile(self, oid, file=None):
raise 'Not yet implemented'
-
+
def getCacheDeactivateAfter(self):
return self._cache_deactivate_after
-
+
def getCacheSize(self):
return self._cache_size
@@ -267,7 +267,7 @@
def getVersionCacheDeactivateAfter(self):
return self._version_cache_deactivate_after
-
+
def getVersionCacheSize(self):
return self._version_cache_size
@@ -336,7 +336,7 @@
def objectCount(self):
return len(self._storage)
-
+
def open(self, version='', transaction=None, temporary=0, force=None,
waitflag=1):
"""Return a object space (AKA connection) to work in
@@ -354,7 +354,7 @@
"""
if type(version) is not StringType:
raise POSException.Unimplemented, 'temporary versions'
-
+
self._a()
try:
@@ -366,7 +366,7 @@
else:
transaction._connections=connections={}
transaction=transaction._connections
-
+
if temporary:
# This is a temporary connection.
@@ -407,7 +407,7 @@
# the last connection from the pool and just after adding
# a connection to an empty pool.
-
+
if pools.has_key(version):
pool, allocated, pool_lock = pools[version]
else:
@@ -432,7 +432,7 @@
cache_size=self._cache_size)
allocated.append(c)
pool.append(c)
-
+
if c is None:
if waitflag:
self._r()
@@ -482,17 +482,17 @@
if len(d)==1: d=d[0]
else: d=''
d="%s (%s)" % (d, len(c._cache))
-
+
r.append({
'opened': o and ("%s (%.2fs)" % (ctime(o), t-o)),
'info': d,
'version': version,
})
return r
-
+
def getActivityMonitor(self):
return self._activity_monitor
-
+
def pack(self, t=None, days=0):
if t is None: t=time()
t=t-(days*86400)
@@ -500,7 +500,7 @@
except:
LOG("ZODB", ERROR, "packing", error=sys.exc_info())
raise
-
+
def setCacheDeactivateAfter(self, v):
self._cache_deactivate_after = v
d = self._pools[0]
@@ -539,7 +539,7 @@
if ver:
for c in self._pools[0][ver][1]:
c._cache.cache_size=v
-
+
def setVersionPoolSize(self, v): self._version_pool_size=v
def cacheStatistics(self): return () # :(
@@ -590,7 +590,7 @@
# the code above just invalidated the dest version.
# now we need to invalidate the source!
for oid in oids: db.invalidate(oid, version=self._version)
-
+
class AbortVersion(CommitVersion):
"""An object that will see to version abortion
@@ -610,7 +610,7 @@
in cooperation with a transaction manager.
"""
-
+
# I'm lazy. I'm reusing __init__ and abort and reusing the
# version attr for the transavtion id. There's such a strong
# similarity of rythm, that I think it's justified.
=== Zope/lib/python/ZODB/DemoStorage.py 1.11 => 1.12 ===
--- Zope/lib/python/ZODB/DemoStorage.py:1.11 Fri Mar 29 17:28:40 2002
+++ Zope/lib/python/ZODB/DemoStorage.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Demo ZODB storage
@@ -45,7 +45,7 @@
A record is a tuple:
- oid, serial, pre, vdata, p,
+ oid, serial, pre, vdata, p,
where:
@@ -109,7 +109,7 @@
def __len__(self):
base=self._base
return (base and len(base) or 0) + len(self._index)
-
+
def getSize(self):
s=100
for tid, (p, u, d, e, t) in self._data.items():
@@ -131,12 +131,12 @@
raise POSException.StorageTransactionError(self, transaction)
if not src:
raise POSException.VersionCommitError("Invalid version")
-
+
self._lock_acquire()
try:
v=self._vindex.get(src, None)
if not v: return
-
+
tindex=self._tindex
oids=[]
for r in v.values():
@@ -147,16 +147,16 @@
tindex.append([oid, serial, r, None, p])
else:
# effectively, delete the thing
- tindex.append([oid, None, r, None, None])
+ tindex.append([oid, None, r, None, None])
return oids
finally: self._lock_release()
-
+
def commitVersion(self, src, dest, transaction):
if transaction is not self._transaction:
raise POSException.StorageTransactionError(self, transaction)
-
+
if not src:
raise POSException.VersionCommitError("Invalid source version")
if src == dest:
@@ -167,7 +167,7 @@
try:
v=self._vindex.get(src, None)
if v is None: return
-
+
tindex=self._tindex
oids=[]
for r in v.values():
@@ -179,7 +179,7 @@
else:
new_vdata = None
tindex.append([oid, serial, r, new_vdata, p])
-
+
return oids
@@ -205,10 +205,10 @@
if p is None:
raise KeyError, oid
-
+
return p, serial
finally: self._lock_release()
-
+
def modifiedInVersion(self, oid):
self._lock_acquire()
try:
@@ -232,22 +232,22 @@
except: pass
else:
old= oid, oserial, None, None, p
-
+
nv=None
if old:
oid, oserial, pre, vdata, p = old
-
+
if vdata:
if vdata[0] != version:
raise POSException.VersionLockError, oid
-
+
nv=vdata[1]
else:
nv=old
if serial != oserial:
raise POSException.ConflictError(serials=(oserial, serial))
-
+
serial=self._serial
r=[oid, serial, old, version and (version, nv) or None, data]
self._tindex.append(r)
@@ -274,7 +274,7 @@
def _begin(self, tid, u, d, e):
self._tsize=self._size+120+len(u)+len(d)+len(e)
-
+
def _finish(self, tid, user, desc, ext):
index=self._index
@@ -293,9 +293,9 @@
v=vindex[oldvdata[0]]
del v[oid]
if not v: del vindex[oldvdata[0]]
-
+
index[oid]=r
-
+
if vdata:
version=vdata[0]
v=vindex.get(version, None)
@@ -321,7 +321,7 @@
for r in t:
oid, serial, pre, vdata, p = r
if pre:
-
+
index[oid] = pre
oids.append(oid)
@@ -338,7 +338,7 @@
v=vindex.get(version, None)
if v is None: v=vindex[version]={}
v[oid]=pre
-
+
else:
del index[oid]
if vdata:
@@ -413,7 +413,7 @@
v=vindex[oldvdata[0]]
del v[oid]
if not v: del vindex[oldvdata[0]]
-
+
index[oid]=r
if vdata:
@@ -428,16 +428,16 @@
# Packing is hard, at least when undo is supported.
# Even for a simple storage like this one, packing
# is pretty complex.
-
+
self._lock_acquire()
try:
stop=`apply(TimeStamp, time.gmtime(t)[:5]+(t%60,))`
_data=self._data
-
+
# Build indexes up to the pack time:
index, vindex = self._build_indexes(stop)
-
+
# Now build an index of *only* those objects reachable
# from the root.
rootl=['\0\0\0\0\0\0\0\0']
@@ -447,7 +447,7 @@
while rootl:
oid=pop()
if referenced(oid): continue
-
+
# Scan non-version pickle for references
r=index.get(oid, None)
if r is None:
@@ -463,7 +463,7 @@
if nv:
oid, serial, pre, vdata, p = nv
referencesf(p, rootl)
-
+
# Now we're ready to do the actual packing.
# We'll simply edit the transaction data in place.
# We'll defer deleting transactions till the end
@@ -484,7 +484,7 @@
if vdata:
# Version record are current *only* if they
# are indexed
- continue
+ continue
else:
# OK, this isn't a version record, so it may be the
# non-version record for the indexed record.
@@ -500,16 +500,16 @@
# record for it.
continue
o.append(r)
-
+
if o:
if len(o) != len(t):
_data[tid]=1, u, d, e, tuple(o) # Reset data
else:
deleted.append(tid)
-
+
# Now delete empty transactions
for tid in deleted: del _data[tid]
-
+
# Now reset previous pointers for "current" records:
for r in pindex.values():
r[2]=None # Previous record
@@ -517,7 +517,7 @@
r[3][1][2]=None
pindex=None
-
+
# Finally, rebuild indexes from transaction data:
self._index, self._vindex = self._build_indexes()
@@ -559,6 +559,6 @@
for oid, r in vitems:
if r: r=id(r)
o.append(' %s: %s' % (utils.u64(oid), r))
-
-
+
+
return string.join(o,'\n')
=== Zope/lib/python/ZODB/ExportImport.py 1.13 => 1.14 ===
--- Zope/lib/python/ZODB/ExportImport.py:1.13 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/ExportImport.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Support for database export and import.
@@ -60,7 +60,7 @@
file=open(file,'rb')
else:
try: file_name=file.name
- except: file_name='(unknown)'
+ except: file_name='(unknown)'
read=file.read
magic=read(4)
@@ -100,7 +100,7 @@
atoi=string.atoi, TupleType=type(()),
oids=oids, wrote_oid=oids.has_key,
new_oid=storage.new_oid):
-
+
"Remap a persistent id to a new ID and create a ghost for it."
if type(ooid) is TupleType: ooid, klass = ooid
@@ -168,4 +168,3 @@
def persistent_id(object, Ghost=Ghost):
if getattr(object, '__class__', None) is Ghost:
return object.oid
-
=== Zope/lib/python/ZODB/FileStorage.py 1.94 => 1.95 === (626/726 lines abridged)
--- Zope/lib/python/ZODB/FileStorage.py:1.94 Mon Jun 24 16:10:26 2002
+++ Zope/lib/python/ZODB/FileStorage.py Wed Aug 14 18:07:09 2002
@@ -2,98 +2,98 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
-#
+#
# File-based ZODB storage
-#
+#
# Files are arranged as follows.
-#
+#
# - The first 4 bytes are a file identifier.
-#
+#
# - The rest of the file consists of a sequence of transaction
# "records".
-#
+#
# A transaction record consists of:
-#
+#
# - 8-byte transaction id, which is also a time stamp.
-#
+#
# - 8-byte transaction record length - 8.
-#
+#
# - 1-byte status code
-#
+#
# - 2-byte length of user name
-#
-# - 2-byte length of description
-#
-# - 2-byte length of extension attributes
-#
[-=- -=- -=- 626 lines omitted -=- -=- -=-]
error("couldn\'t write truncated data for %s", name)
raise POSException.StorageSystemError, (
"Couldn't save truncated data")
-
+
seek(pos)
file.truncate()
@@ -2177,7 +2177,7 @@
"""
_ltid = z64
_file = None
-
+
def __init__(self, file, start=None, stop=None):
if isinstance(file, StringType):
file = open(file, 'rb')
@@ -2201,7 +2201,7 @@
def _skip_to_start(self, start):
# Scan through the transaction records doing almost no sanity
- # checks.
+ # checks.
while 1:
self._file.seek(self._pos)
h = self._file.read(16)
@@ -2335,7 +2335,7 @@
return result
raise IndexError, index
-
+
class RecordIterator(Iterator, BaseStorage.TransactionRecord):
"""Iterate over the transactions in a FileStorage file.
"""
@@ -2391,11 +2391,11 @@
p = None
else:
p = _loadBack(file, oid, p)[0]
-
+
r = Record(oid, serial, version, p)
-
+
return r
-
+
raise IndexError, index
class Record(BaseStorage.DataRecord):
=== Zope/lib/python/ZODB/MappingStorage.py 1.6 => 1.7 ===
--- Zope/lib/python/ZODB/MappingStorage.py:1.6 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/MappingStorage.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Very Simple Mapping ZODB storage
@@ -53,7 +53,7 @@
A record is a tuple:
- oid, serial, pre, vdata, p,
+ oid, serial, pre, vdata, p,
where:
@@ -108,14 +108,14 @@
def __len__(self):
return len(self._index)
-
+
def getSize(self):
s=32
index=self._index
for oid in index.keys():
p=index[oid]
s=s+56+len(p)
-
+
return s
def load(self, oid, version):
@@ -139,7 +139,7 @@
oserial=old[:8]
if serial != oserial:
raise POSException.ConflictError(serials=(oserial, serial))
-
+
serial=self._serial
self._tindex.append((oid,serial+data))
finally: self._lock_release()
@@ -155,9 +155,9 @@
for oid, p in self._tindex: index[oid]=p
def pack(self, t, referencesf):
-
+
self._lock_acquire()
- try:
+ try:
# Build an index of *only* those objects reachable
# from the root.
index=self._index
@@ -168,7 +168,7 @@
while rootl:
oid=pop()
if referenced(oid): continue
-
+
# Scan non-version pickle for references
r=index[oid]
pindex[oid]=r
@@ -178,7 +178,7 @@
# Now delete any unreferenced entries:
for oid in index.keys():
if not referenced(oid): del index[oid]
-
+
finally: self._lock_release()
def _splat(self):
@@ -193,5 +193,5 @@
r=index[oid]
o.append(' %s: %s, %s' %
(utils.u64(oid),TimeStamp(r[:8]),`r[8:]`))
-
+
return string.join(o,'\n')
=== Zope/lib/python/ZODB/Mount.py 1.15 => 1.16 ===
--- Zope/lib/python/ZODB/Mount.py:1.15 Thu May 23 16:53:22 2002
+++ Zope/lib/python/ZODB/Mount.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Mounted database support
@@ -188,7 +188,7 @@
data = t[0]
return data.__of__(parent)
-
+
def __of__(self, parent):
# Accesses the database, returning an acquisition
# wrapper around the connected object rather than around self.
@@ -277,7 +277,7 @@
try: del conn._mount_parent_jar
except: pass
conn.close()
-
+
if close_db:
# Stop using this database. Close it if no other
# MountPoint is using it.
=== Zope/lib/python/ZODB/POSException.py 1.11 => 1.12 ===
--- Zope/lib/python/ZODB/POSException.py:1.11 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/POSException.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""BoboPOS-defined exceptions
@@ -193,7 +193,7 @@
class Unsupported(POSError):
"""An feature that is unsupported bt the storage was used.
"""
-
+
class InvalidObjectReference(POSError):
"""An object contains an invalid reference to another object.
=== Zope/lib/python/ZODB/PersistentList.py 1.2 => 1.3 ===
--- Zope/lib/python/ZODB/PersistentList.py:1.2 Mon Feb 11 18:49:07 2002
+++ Zope/lib/python/ZODB/PersistentList.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Python implementation of persistent list.
@@ -51,7 +51,7 @@
def __delslice__(self, i, j):
self.__super_delslice(i, j)
self._p_changed = 1
-
+
def __iadd__(self, other):
self.__super_iadd(other)
self._p_changed = 1
@@ -63,7 +63,7 @@
def append(self, item):
self.__super_append(item)
self._p_changed = 1
-
+
def insert(self, i, item):
self.__super_insert(i, item)
self._p_changed = 1
@@ -76,11 +76,11 @@
def remove(self, item):
self.__super_remove(item)
self._p_changed = 1
-
+
def reverse(self):
self.__super_reverse()
self._p_changed = 1
-
+
def sort(self, *args):
self.__super_sort(*args)
self._p_changed = 1
=== Zope/lib/python/ZODB/PersistentMapping.py 1.19 => 1.20 ===
--- Zope/lib/python/ZODB/PersistentMapping.py:1.19 Tue Feb 12 17:33:08 2002
+++ Zope/lib/python/ZODB/PersistentMapping.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Python implementation of persistent base types
@@ -82,7 +82,7 @@
# different versions of the code. Compatibility works in both
# directions, because an application may want to share a database
# between applications using different versions of the code.
-
+
# Effectively, the original rep is part of the "API." To provide
# full compatibility, the getstate and setstate must read and
# right objects using the old rep.
=== Zope/lib/python/ZODB/TmpStore.py 1.6 => 1.7 ===
--- Zope/lib/python/ZODB/TmpStore.py:1.6 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/TmpStore.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import POSException
@@ -53,7 +53,7 @@
if h[:8] != oid:
raise POSException.StorageSystemError, 'Bad temporary storage'
return file.read(u64(h[16:])), h[8:16]
-
+
def modifiedInVersion(self, oid):
if self._index.has_key(oid): return 1
return self._db._storage.modifiedInVersion(oid)
@@ -78,7 +78,7 @@
self._tindex.append((oid,pos))
self._pos=pos+l+24
return serial
-
+
def tpc_abort(self, transaction):
if transaction is not self._transaction: return
del self._tindex[:]
@@ -103,6 +103,6 @@
self._tpos=self._pos
def undoLog(self, first, last, filter=None): return ()
-
+
def versionEmpty(self, version):
if version is self: return len(self._index)
=== Zope/lib/python/ZODB/Transaction.py 1.36 => 1.37 ===
--- Zope/lib/python/ZODB/Transaction.py:1.36 Fri Apr 12 15:59:55 2002
+++ Zope/lib/python/ZODB/Transaction.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Transaction management
@@ -39,7 +39,7 @@
# commits and aborts to ensure that they are correctly committed
# or aborted in the "outside" transaction.
_non_st_objects=None
-
+
def __init__(self, id=None):
self._id=id
self._objects=[]
@@ -60,7 +60,7 @@
r.description=self.description
r._extension=self._extension
return r
-
+
def __str__(self):
if self._id is None:
return "Transaction user=%s" % `self.user`
@@ -117,7 +117,7 @@
while subjars:
j = subjars.pop()
j.abort_sub(self) # This should never fail
-
+
if t is not None:
raise t, v, tb
@@ -207,7 +207,7 @@
vote(self) # last chance to bail
# Try to finish one jar, since we may be able to
- # recover if the first one fails.
+ # recover if the first one fails.
self._finish_one(jarsv)
# Once a single jar has finished, it's a fatal (hosed)
# error if another jar fails.
@@ -234,7 +234,7 @@
i = id(j)
if not jars.has_key(i):
jars[i] = j
-
+
if subtransaction:
# If a jar does not support subtransactions,
# we need to save it away to be committed in
@@ -285,7 +285,7 @@
while jarsv:
jarsv[-1].tpc_finish(self) # This should never fail
jarsv.pop() # It didn't, so it's taken care of.
- except:
+ except:
# Bug if it does, we need to yell FIRE!
# Someone finished, so don't allow any more
# work without at least a restart!
@@ -298,12 +298,12 @@
"until the site/storage is reset by a restart. ",
error=sys.exc_info())
raise
-
+
def _commit_error(self, (t, v, tb),
objects, ncommitted, jarsv, subjars):
# handle an exception raised during commit
# takes sys.exc_info() as argument
-
+
# First, we have to abort any uncommitted objects.
for o in objects[ncommitted:]:
try:
@@ -317,11 +317,11 @@
for j in jarsv:
try:
j.tpc_abort(self) # This should never fail
- except:
+ except:
LOG('ZODB', ERROR,
"A storage error occured during object abort. This "
"shouldn't happen. ", error=sys.exc_info())
-
+
# Ugh, we need to abort work done in sub-transactions.
while subjars:
j = subjars.pop()
@@ -342,9 +342,9 @@
def note(self, text):
if self.description:
self.description = "%s\n\n%s" % (self.description, strip(text))
- else:
+ else:
self.description = strip(text)
-
+
def setUser(self, user_name, path='/'):
self.user="%s %s" % (path, user_name)
@@ -366,7 +366,7 @@
the system problem. See your application log for
information on the error that lead to this problem.
"""
-
+
############################################################################
@@ -377,16 +377,16 @@
except:
_t = Transaction(None)
-
+
def get_transaction(_t=_t):
return _t
-
+
def free_transaction(_t=_t):
_t.__init__()
else:
_t = {}
-
+
def get_transaction(_id=thread.get_ident, _t=_t, get=_t.get):
id = _id()
t = get(id, None)
@@ -405,6 +405,5 @@
del _t
-import __main__
+import __main__
__main__.__builtins__.get_transaction=get_transaction
-
=== Zope/lib/python/ZODB/UndoLogCompatible.py 1.5 => 1.6 ===
--- Zope/lib/python/ZODB/UndoLogCompatible.py:1.5 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/UndoLogCompatible.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Provide backward compatability with storages that have undoLog, but not undoInfo."""
@@ -25,5 +25,5 @@
return 0
return 1
else: filter=None
-
+
return self.undoLog(first, last, filter)
=== Zope/lib/python/ZODB/ZApplication.py 1.10 => 1.11 ===
--- Zope/lib/python/ZODB/ZApplication.py:1.10 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/ZApplication.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Implement an bobo_application object that is BoboPOS3 aware
@@ -34,7 +34,7 @@
get_transaction().commit()
conn.close()
self._klass=klass
-
+
# This hack is to overcome a bug in Bobo!
def __getattr__(self, name):
@@ -57,16 +57,16 @@
REQUEST._hold(cleanup)
conn.setDebugInfo(REQUEST.environ, REQUEST.other)
-
+
v=conn.root()[aname]
if name is not None:
if hasattr(v, '__bobo_traverse__'):
return v.__bobo_traverse__(REQUEST, name)
-
+
if hasattr(v,name): return getattr(v,name)
return v[name]
-
+
return v
@@ -77,9 +77,8 @@
connection=db.open()
elif type(connection) is StringType:
connection=db.open(connection)
-
+
return connection.root()[aname]
-
-class Cleanup: pass
+class Cleanup: pass
=== Zope/lib/python/ZODB/__init__.py 1.12 => 1.13 ===
--- Zope/lib/python/ZODB/__init__.py:1.12 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/__init__.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import sys, ExtensionClass, TimeStamp, cPersistence, Persistence
import cStringIO, cPickle
=== Zope/lib/python/ZODB/bpthread.py 1.4 => 1.5 ===
--- Zope/lib/python/ZODB/bpthread.py:1.4 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/bpthread.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Thread abstraction module
=== Zope/lib/python/ZODB/conversionhack.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/conversionhack.py:1.3 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/conversionhack.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import PersistentMapping
=== Zope/lib/python/ZODB/dbmStorage.py 1.3 => 1.4 ===
--- Zope/lib/python/ZODB/dbmStorage.py:1.3 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/dbmStorage.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Very Simple dbm-based ZODB storage
@@ -40,7 +40,7 @@
def getSize(self):
# This is a little iffy, since we aren't entirely sure what the file is
self._lock_acquire()
- try:
+ try:
try:
return (os.stat(self.__name__+'.data')[6] +
os.stat(self.__name__+'.dir')[6]
@@ -73,9 +73,9 @@
finally: self._lock_release()
def pack(self, t, referencesf):
-
+
self._lock_acquire()
- try:
+ try:
# Build an index of *only* those objects reachable
# from the root.
index=self._index
@@ -86,7 +86,7 @@
while rootl:
oid=pop()
if referenced(oid): continue
-
+
# Scan non-version pickle for references
r=index[oid]
pindex[oid]=r
@@ -107,7 +107,7 @@
index.sync()
index.reorganize()
-
+
finally: self._lock_release()
=== Zope/lib/python/ZODB/fsIndex.py 1.2 => 1.3 ===
--- Zope/lib/python/ZODB/fsIndex.py:1.2 Mon Feb 11 18:49:07 2002
+++ Zope/lib/python/ZODB/fsIndex.py Wed Aug 14 18:07:09 2002
@@ -2,33 +2,33 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Implement an OID to File-position (long integer) mapping
"""
-#
+#
# To save space, we do two things:
-#
+#
# 1. We split the keys (OIDS) into 6-byte prefixes and 2-byte suffixes.
# We use the prefixes as keys in a mapping from prefix to mappings
# of suffix to data:
-#
+#
# data is {prefix -> {suffix -> data}}
-#
+#
# 2. We limit the data size to 48 bits. This should allow databases
# as large as 256 terabytes.
-#
+#
# Mostof the space is consumed by items in the mappings from 2-byte
# suffix to 6-byte data. This should reduce the overall memory usage to
# 8-16 bytes per OID.
-#
+#
# We use p64 to convert integers to 8-byte strings and lop off the two
# high-order bytes when saving. On loading data, we add the leading
# bytes back before using U64 to convert the data back to (long)
@@ -51,7 +51,7 @@
if h:
return (long(h) << 32) + l
else:
- return l
+ return l
class fsIndex:
=== Zope/lib/python/ZODB/fsrecover.py 1.4 => 1.5 ===
--- Zope/lib/python/ZODB/fsrecover.py:1.4 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/fsrecover.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
@@ -49,14 +49,14 @@
Pack data to t seconds in the past. Note that is the "-p"
option is used, then t should be 0.
-
+
Important note: The ZODB package must be imporable. You may need
to adjust the Python path accordingly.
"""
# Algorithm:
-#
+#
# position to start of input
# while 1:
# if end of file: break
@@ -81,7 +81,7 @@
elif os.path.exists('FileStorage.py'): sys.path.append('..')
import ZODB
-
+
import getopt, ZODB.FileStorage, struct, time
from struct import unpack
from ZODB.utils import t32, p64, U64
@@ -185,7 +185,7 @@
sys.stdout.flush()
def progress(p):
- for i in range(p): iprogress(i)
+ for i in range(p): iprogress(i)
def recover(argv=sys.argv):
@@ -199,7 +199,7 @@
elif opt == '-f': force=1
elif opt == '-P': pack=time.time()-float(v)
-
+
force = filter(lambda opt: opt[0]=='-f', opts)
partial = filter(lambda opt: opt[0]=='-p', opts)
verbose = filter(lambda opt: opt[0]=='-v', opts)
@@ -208,7 +208,7 @@
except:
die()
print __doc__ % argv[0]
-
+
if os.path.exists(outp) and not force:
die("%s exists" % outp)
@@ -267,7 +267,7 @@
ok=1
if verbose:
- print 'begin',
+ print 'begin',
if verbose > 1: print
sys.stdout.flush()
@@ -317,14 +317,13 @@
print "\n%s bytes removed during recovery" % bad
if undone:
print "%s bytes of undone transaction data were skipped" % undone
-
+
if pack is not None:
print "Packing ..."
from ZODB.referencesf import referencesf
ofs.pack(pack, referencesf)
ofs.close()
-
-if __name__=='__main__': recover()
+if __name__=='__main__': recover()
=== Zope/lib/python/ZODB/lock_file.py 1.5 => 1.6 ===
--- Zope/lib/python/ZODB/lock_file.py:1.5 Mon Feb 11 18:40:42 2002
+++ Zope/lib/python/ZODB/lock_file.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import POSException
@@ -44,15 +44,14 @@
un=file.fileno()
except:
return # don't care if not a real file
-
+
try:
LockFile(un,0,0,1,0) # just lock the first byte, who cares
except:
raise error, (
"Could not lock the database file. There must be\n"
"another process that has opened the file.\n"
- "<p>")
+ "<p>")
except:
def lock_file(file, error=None):
pass
-
=== Zope/lib/python/ZODB/referencesf.py 1.5 => 1.6 ===
--- Zope/lib/python/ZODB/referencesf.py:1.5 Mon May 13 09:20:04 2002
+++ Zope/lib/python/ZODB/referencesf.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Provide a function that can find object references in pickles
"""
=== Zope/lib/python/ZODB/utils.py 1.11 => 1.12 ===
--- Zope/lib/python/ZODB/utils.py:1.11 Mon Apr 22 18:24:06 2002
+++ Zope/lib/python/ZODB/utils.py Wed Aug 14 18:07:09 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import sys
@@ -64,7 +64,7 @@
read = f1.read
write = f2.write
n = 8192
-
+
while l > 0:
if n > l:
n = l