[Zope3-checkins] CVS: Zope3/src/zodb - __init__.py:1.1.2.2 conflict.py:1.1.2.2 connection.py:1.1.2.4 db.py:1.1.2.4 dbdump.py:1.1.2.3 export.py:1.1.2.2 interfaces.py:1.1.2.4 serialize.py:1.1.2.3 timestamp.py:1.1.2.3 utils.py:1.1.2.2 ztransaction.py:1.1.2.2
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:33 -0500
Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zodb
Modified Files:
Tag: NameGeddon-branch
__init__.py conflict.py connection.py db.py dbdump.py
export.py interfaces.py serialize.py timestamp.py utils.py
ztransaction.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zodb/__init__.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zodb/__init__.py:1.1.2.1 Mon Dec 23 14:30:43 2002
+++ Zope3/src/zodb/__init__.py Tue Dec 24 21:19:59 2002
@@ -2,13 +2,12 @@
#
# 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.
-#
+#
##############################################################################
-
=== Zope3/src/zodb/conflict.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zodb/conflict.py:1.1.2.1 Mon Dec 23 14:30:43 2002
+++ Zope3/src/zodb/conflict.py Tue Dec 24 21:19:59 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.
-#
+#
##############################################################################
# It's hard to draw a clear separation between these two modules,
=== Zope3/src/zodb/connection.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zodb/connection.py:1.1.2.3 Mon Dec 23 18:48:42 2002
+++ Zope3/src/zodb/connection.py Tue Dec 24 21:19:59 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 zodb import interfaces
from zodb.utils import p64, u64, Set, z64
@@ -42,7 +42,7 @@
def getName(self):
return self._db.getName()
-
+
def getSize(self):
return self._pos
@@ -57,7 +57,7 @@
size = u64(h[16:])
serial = h[8:16]
return self._file.read(size), serial
-
+
# XXX clarify difference between self._storage & self._db._storage
def modifiedInVersion(self, oid):
@@ -84,7 +84,7 @@
self._tindex[oid] = self._pos
self._pos += l + 24
return serial
-
+
def tpc_abort(self, transaction):
if transaction is not self._transaction:
return
@@ -115,7 +115,7 @@
def undoLog(self, first, last, filter=None):
return ()
-
+
def versionEmpty(self, version):
# XXX what is this supposed to do?
if version == self._bver:
@@ -139,7 +139,7 @@
def current(self, cur_store):
"""Return true if the UndoInfo is for cur_store."""
return self._store is cur_store
-
+
def rollback(self):
self._store.rollback(self._pos, self._index)
@@ -235,16 +235,16 @@
self._inv_lock = threading.Lock()
self._invalidated = Set()
self._committed = []
-
+
# track which objects are involved with a transaction
self._txns = {}
self._modified = Set()
self._created = Set()
-
+
def getVersion(self):
return self._version
-
+
def modifiedInVersion(self, oid):
try:
return self._storage.modifiedInVersion(oid)
@@ -286,9 +286,9 @@
# XXX Is it possible to reorganize the method-level try/except?
try:
oid = object._p_oid
-
+
# XXX this is quite conservative!
-
+
# Avoid reading data from a transaction that committed
# after the current transaction started, as that might
# lead to mixing of cached data from earlier transactions
@@ -369,9 +369,9 @@
self._db._closeConnection(self)
# XXX not sure what the callbacks are for, but they're used by Mount
-
+
__onCloseCallbacks = None
-
+
def onCloseCallback(self, f):
if self.__onCloseCallbacks is None:
self.__onCloseCallbacks = []
@@ -393,7 +393,7 @@
def cacheFullSweep(self, dt=0):
self._cache.full_sweep(dt)
-
+
def cacheMinimize(self, dt=0):
self._cache.minimize(dt)
@@ -424,7 +424,7 @@
def objcommit(self, object, transaction):
oid = object._p_oid
self._logger.debug("commit object %s", u64(oid))
-
+
if oid is None or object._p_jar is not self:
oid = self.new_oid()
object._p_jar = self
@@ -468,17 +468,17 @@
def commit_sub(self, txn):
"""Commit all work done in subtransactions"""
assert self._tmp is not None
-
+
tmp = self._storage
self._storage = self._tmp
self._tmp = None
self._storage.tpc_begin(txn)
-
+
# Copy invalidating and creating info from temporary storage:
self._modified |= Set(tmp._index)
self._created |= tmp._created
-
+
for oid in tmp._index:
data, serial = tmp.load(oid, tmp._bver)
s = self._storage.store(oid, serial, data, self._version, txn)
@@ -506,7 +506,7 @@
######################################################################
# Transaction.IDataManager
-
+
def oldstate(self, object, serial):
"""Return the state of an object as of serial.
@@ -524,7 +524,7 @@
self._modified = Set()
self._created = Set()
self._storage.tpc_begin(txn)
-
+
for obj in self._txns.get(txn, ()):
self.objcommit(obj, txn)
self.importHook(txn) # hook for ExportImport
@@ -581,7 +581,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):
@@ -641,7 +641,7 @@
if sync is not None:
sync()
self._flush_invalidations()
-
+
class Rollback:
"""Rollback changes associated with savepoint"""
=== Zope3/src/zodb/db.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zodb/db.py:1.1.2.3 Mon Dec 23 18:48:42 2002
+++ Zope3/src/zodb/db.py Tue Dec 24 21:19:59 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
@@ -96,7 +96,7 @@
# Pool now usable again, unlock it.
self._pool_lock.release()
finally: self._r()
-
+
def _connectionMap(self, f):
self._a()
try:
@@ -247,7 +247,7 @@
if self._pool_size > len(self._pool) or force:
c = Connection(self, version, cache_size=self._cache_size)
self._pool.append(c)
-
+
if c is None:
if waitflag:
self._r()
@@ -295,7 +295,7 @@
except:
logging.getLogger("zodb").exception("packing")
raise
-
+
def setCacheSize(self, v):
self._cache_size = v
for c in self._pool:
@@ -303,14 +303,14 @@
def setPoolSize(self, v):
self._pool_size = v
-
+
def undo(self, id):
TransactionalUndo(self, id)
class SimpleDataManager:
__implements__ = IDataManager
-
+
def __init__(self, db):
self._db = db
self._storage = db._storage
@@ -358,7 +358,7 @@
# now we need to invalidate the source!
for oid in self._oids:
self._db.invalidate(oid, version=self._version)
-
+
class AbortVersion(SimpleDataManager):
"""An object that will see to version abortion."""
@@ -368,7 +368,7 @@
def _prepare(self, txn):
self._oids = self._storage.abortVersion(self._version, txn)
-
+
def commit(self, txn):
super(AbortVersion, self).commit(txn)
for oid in self._oids:
@@ -376,14 +376,14 @@
class TransactionalUndo(SimpleDataManager):
"""An object that will see to transactional undo."""
-
+
def __init__(self, db, tid):
super(TransactionalUndo, self).__init__(db)
self._tid = tid
def _prepare(self, txn):
self._oids = self._storage.transactionalUndo(self._tid, txn)
-
+
def commit(self, txn):
super(TransactionalUndo, self).commit(txn)
for oid in self._oids:
=== Zope3/src/zodb/dbdump.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zodb/dbdump.py:1.1.2.2 Mon Dec 23 18:48:42 2002
+++ Zope3/src/zodb/dbdump.py Tue Dec 24 21:19:59 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 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 text dump of a storage based on a storage iterator."""
=== Zope3/src/zodb/export.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zodb/export.py:1.1.2.1 Mon Dec 23 14:30:43 2002
+++ Zope3/src/zodb/export.py Tue Dec 24 21:19:59 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."""
@@ -97,7 +97,7 @@
def _importDuringCommit(self, txn, file, return_oid_list):
"""Invoked by the transaction manager mid commit.
-
+
Appends one item, the OID of the first object created,
to return_oid_list.
"""
=== Zope3/src/zodb/interfaces.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zodb/interfaces.py:1.1.2.3 Mon Dec 23 18:48:42 2002
+++ Zope3/src/zodb/interfaces.py Tue Dec 24 21:19:59 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-defined exceptions
@@ -172,7 +172,7 @@
class MultipleUndoErrors(UndoError):
"""Several undo errors occured during a single transaction."""
-
+
def __init__(self, errs):
# provide an oid and reason for clients that only look at that
UndoError.__init__(self, *errs[0])
@@ -204,7 +204,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.
@@ -244,7 +244,7 @@
called with None as the oid, which would mean the "entire
transaction" is invalidated.
"""
-
+
def close():
pass
@@ -280,11 +280,10 @@
# use the attributes.
user = Attribute("The user as set by setUser()")
-
+
description = Attribute("A description as set by note()")
-
+
_extension = Attribute(
"""Extended info as set by setExtendedInfo()
Should be None or a dictionary.""")
-
=== Zope3/src/zodb/serialize.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zodb/serialize.py:1.1.2.2 Mon Dec 23 18:48:42 2002
+++ Zope3/src/zodb/serialize.py Tue Dec 24 21:19:59 2002
@@ -96,7 +96,7 @@
if jar is not None:
assert hasattr(jar, "new_oid")
self._jar = jar
-
+
def _persistent_id(self, obj):
"""Test if an object is persistent, returning an oid if it is.
@@ -110,7 +110,7 @@
"""
if not hasattr(obj, '_p_oid'):
return None
-
+
oid = obj._p_oid
# I'd like to write something like this --
@@ -175,14 +175,14 @@
unpickler = cPickle.Unpickler(file)
unpickler.persistent_load = self._persistent_load
return unpickler
-
+
def _new_object(self, module, classname, newargs=None):
klass = getClass(module, classname)
if newargs is None:
obj = klass.__new__(klass)
else:
obj = klass.__new__(klass, *newargs)
-
+
return obj
def getClassName(self, pickle):
@@ -229,7 +229,7 @@
# persistent_load function to pass to ObjectReader
if isinstance(oid, TupleType):
# XXX We get here via new_persistent_id()
-
+
# Quick instance reference. We know all we need to know
# to create the instance w/o hitting the db, so go for it!
oid, classmeta = oid
@@ -243,7 +243,7 @@
obj._p_oid = oid
obj._p_jar = self._conn
obj._p_changed = None
-
+
self._cache[oid] = obj
return obj
=== Zope3/src/zodb/timestamp.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zodb/timestamp.py:1.1.2.2 Mon Dec 23 16:36:56 2002
+++ Zope3/src/zodb/timestamp.py Tue Dec 24 21:19:59 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 time
=== Zope3/src/zodb/utils.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zodb/utils.py:1.1.2.1 Mon Dec 23 14:30:43 2002
+++ Zope3/src/zodb/utils.py Tue Dec 24 21:19:59 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 zodb.timestamp import TimeStamp
import struct
@@ -29,7 +29,7 @@
read = f1.read
write = f2.write
n = 8192
-
+
while l > 0:
if n > l:
n = l
=== Zope3/src/zodb/ztransaction.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zodb/ztransaction.py:1.1.2.1 Mon Dec 23 14:30:43 2002
+++ Zope3/src/zodb/ztransaction.py Tue Dec 24 21:19:59 2002
@@ -35,9 +35,9 @@
def note(self, text):
if self.description:
self.description = "%s\n\n%s" % (self.description, text)
- else:
+ else:
self.description = text
-
+
def setUser(self, user_name, path='/'):
self.user = "%s %s" % (path, user_name)