[Checkins] SVN: Products.Ape/trunk/ checkpoint: trying to port Ape
to Zope 2.11
Thomas Lotze
tl at gocept.com
Wed Sep 12 11:04:34 EDT 2007
Log message for revision 79593:
checkpoint: trying to port Ape to Zope 2.11
Changed:
U Products.Ape/trunk/datatypes.py
U Products.Ape/trunk/lib/apelib/tests/teststorage.py
U Products.Ape/trunk/lib/apelib/tests/testzodbtables.py
U Products.Ape/trunk/lib/apelib/tests/testzope2fs.py
U Products.Ape/trunk/lib/apelib/tests/testzope2sql.py
U Products.Ape/trunk/lib/apelib/tests/zope2testbase.py
U Products.Ape/trunk/lib/apelib/zodb3/connection.py
U Products.Ape/trunk/lib/apelib/zodb3/db.py
U Products.Ape/trunk/lib/apelib/zope2/apeconf.xml
-=-
Modified: Products.Ape/trunk/datatypes.py
===================================================================
--- Products.Ape/trunk/datatypes.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/datatypes.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -17,7 +17,7 @@
"""
from ZODB.config import BaseConfig
-from Zope.Startup.datatypes import ZopeDatabase
+from Zope2.Startup.datatypes import ZopeDatabase
from apelib.zope2.mapper import load_conf
from apelib.zodb3 import storage, db, resource
@@ -38,7 +38,7 @@
class Database(ZopeDatabase):
- def createDB(self):
+ def createDB(self, database_name, databases):
config = self.config
if config.mapper_variation:
conf = load_conf(config.mapper_variation, search_products=1)
Modified: Products.Ape/trunk/lib/apelib/tests/teststorage.py
===================================================================
--- Products.Ape/trunk/lib/apelib/tests/teststorage.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/tests/teststorage.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -19,6 +19,7 @@
import unittest
from thread import start_new_thread, allocate_lock
+from transaction import get as get_transaction
import ZODB
from Persistence import Persistent, PersistentMapping
Modified: Products.Ape/trunk/lib/apelib/tests/testzodbtables.py
===================================================================
--- Products.Ape/trunk/lib/apelib/tests/testzodbtables.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/tests/testzodbtables.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -19,6 +19,8 @@
import unittest
from time import time
+from transaction import get as get_transaction
+
from apelib.zodb3 import zodbtables
Modified: Products.Ape/trunk/lib/apelib/tests/testzope2fs.py
===================================================================
--- Products.Ape/trunk/lib/apelib/tests/testzope2fs.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/tests/testzope2fs.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -23,6 +23,7 @@
from tempfile import mktemp
from cStringIO import StringIO
+from transaction import get as get_transaction
from OFS.Application import Application
from OFS.Image import File, manage_addImage, manage_addFile
from Products.PythonScripts.PythonScript import PythonScript
Modified: Products.Ape/trunk/lib/apelib/tests/testzope2sql.py
===================================================================
--- Products.Ape/trunk/lib/apelib/tests/testzope2sql.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/tests/testzope2sql.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -19,6 +19,8 @@
import unittest
import sys
+from transaction import get as get_transaction
+
from apelib.zodb3.db import ApeDB
from apelib.zodb3.storage import ApeStorage
from apelib.zodb3.resource import StaticResource
Modified: Products.Ape/trunk/lib/apelib/tests/zope2testbase.py
===================================================================
--- Products.Ape/trunk/lib/apelib/tests/zope2testbase.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/tests/zope2testbase.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -20,6 +20,7 @@
import time
from types import ListType, TupleType
+from transaction import get as get_transaction
from Acquisition import aq_base
from Persistence import Persistent
from ZODB import POSException
Modified: Products.Ape/trunk/lib/apelib/zodb3/connection.py
===================================================================
--- Products.Ape/trunk/lib/apelib/zodb3/connection.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/zodb3/connection.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -24,7 +24,7 @@
from Acquisition import aq_base
from Persistence import Persistent
-from ZODB.Transaction import Transaction
+from transaction import Transaction, get as get_transaction
from ZODB.POSException \
import ConflictError, ReadConflictError, InvalidObjectReference, \
StorageError
@@ -186,15 +186,17 @@
if obj is self:
self._may_begin(transaction)
# We registered ourself. Execute a commit action, if any.
- if self._Connection__onCommitActions is not None:
- method_name, args, kw = \
- self._Connection__onCommitActions.pop(0)
- apply(getattr(self, method_name), (transaction,) + args, kw)
+
+# XXX Where is the _Connection_onCommitActions ever set?
+# if self._Connection__onCommitActions is not None:
+# method_name, args, kw = \
+# self._Connection__onCommitActions.pop(0)
+# apply(getattr(self, method_name), (transaction,) + args, kw)
return
oid=obj._p_oid
assert oid != 'unmanaged', repr(obj)
#invalid=self._invalidated.get
- invalid = self._invalid
+ invalid = self._invalidated.__contains__
modified = getattr(self, '_modified', None)
if modified is None:
@@ -247,7 +249,7 @@
serial = self._get_serial(obj)
if serial == HASH0:
# new object
- self._creating.append(oid)
+ self._creating[oid] = True
else:
#XXX We should never get here
# SDH: Actually it looks like we should, but only
@@ -332,7 +334,7 @@
# notifications between the time we check and the time we
# read.
#invalid = self._invalidated.get
- invalid = self._invalid
+ invalid = self._invalidated.__contains__
if invalid(oid) or invalid(None):
if not hasattr(obj.__class__, '_p_independent'):
get_transaction().register(self)
@@ -364,7 +366,7 @@
if invalid:
if obj._p_independent():
- try: del self._invalidated[oid]
+ try: self._invalidated.remove(oid)
except KeyError: pass
else:
get_transaction().register(self)
@@ -434,7 +436,7 @@
def get_class(self, module, name):
- return self._db._classFactory(self, module, name)
+ return self._db.classFactory(self, module, name)
def check_serials(self):
Modified: Products.Ape/trunk/lib/apelib/zodb3/db.py
===================================================================
--- Products.Ape/trunk/lib/apelib/zodb3/db.py 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/zodb3/db.py 2007-09-12 15:04:34 UTC (rev 79593)
@@ -19,7 +19,9 @@
import cPickle
import cStringIO
-from ZODB.DB import DB, Transaction, allocate_lock
+from threading import RLock
+from transaction import Transaction
+from ZODB.DB import DB
from apelib.core.interfaces import ConfigurationError
from connection import ApeConnection
@@ -47,6 +49,7 @@
"""
klass = ApeConnection
+ database_name = "unnamed"
# SDH: some extra args.
def __init__(self, storage,
@@ -85,12 +88,12 @@
assert factory is None
# Allocate locks:
- l=allocate_lock()
+ l = RLock()
self._a=l.acquire
self._r=l.release
# Setup connection pools and cache info
- self._pools={},[]
+ self._pools={}
self._temps=[]
self._pool_size=pool_size
self._cache_size=cache_size
@@ -103,7 +106,7 @@
# Setup storage
self._storage=storage
- storage.registerDB(self, None)
+ storage.registerDB(self)
if not hasattr(storage,'tpc_vote'): storage.tpc_vote=lambda *args: None
self._conf_resource = conf_resource
@@ -119,10 +122,7 @@
self._scan_ctl = None
# Pass through methods:
- for m in ('history',
- 'supportsUndo', 'supportsVersions', 'undoLog',
- 'versionEmpty', 'versions'):
- setattr(self, m, getattr(storage, m))
+ self.history = storage.history
if hasattr(storage, 'undoInfo'):
self.undoInfo=storage.undoInfo
@@ -133,4 +133,3 @@
c._prepare_root()
finally:
c.close()
-
Modified: Products.Ape/trunk/lib/apelib/zope2/apeconf.xml
===================================================================
--- Products.Ape/trunk/lib/apelib/zope2/apeconf.xml 2007-09-12 14:30:51 UTC (rev 79592)
+++ Products.Ape/trunk/lib/apelib/zope2/apeconf.xml 2007-09-12 15:04:34 UTC (rev 79593)
@@ -21,7 +21,7 @@
<!-- Root mapper -->
-<mapper name="root" class="Persistence.PersistentMapping">
+<mapper name="root" class="Persistence.mapping.PersistentMapping">
<serializer name="items"
factory="apelib.zodb3.serializers.PersistentMappingSerializer" />
<serializer name="roll_call" factory="apelib.zodb3.serializers.RollCall" />
More information about the Checkins
mailing list