[Zope3-checkins] CVS: Zope3/src/zope/app/rdb - __init__.py:1.23

Fred L. Drake, Jr. fred at zope.com
Fri Feb 20 11:57:58 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/rdb
In directory cvs.zope.org:/tmp/cvs-serv22507/src/zope/app/rdb

Modified Files:
	__init__.py 
Log Message:


update to replace ZODB 4 with ZODB 3


=== Zope3/src/zope/app/rdb/__init__.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/rdb/__init__.py:1.22	Fri Dec 19 11:53:17 2003
+++ Zope3/src/zope/app/rdb/__init__.py	Fri Feb 20 11:57:28 2004
@@ -24,10 +24,11 @@
 import types, string
 from types import StringTypes
 
-from persistence import Persistent
+from persistent import Persistent
 
 from transaction import get_transaction
-from transaction.interfaces import IDataManager
+from transaction.interfaces import IDataManager, IRollback
+from transaction.util import NoSavepointSupportRollback
 
 from zope.security.checker import NamesChecker
 
@@ -365,12 +366,30 @@
     def commit(self, txn):
         self._dbconn.commit()
 
-    # XXX Do any of the Python DB-API implementations support
-    # two-phase commit?
-
     def savepoint(self, txn):
-        return None
+        """Create a savepoint that can not be rolled back
+
+        Savepoint implementation for data managers that do not
+        support savepoints. We don't raise an error here, because
+        there's no harm in ignoring a call if no one ever tries to
+        rollback a savepoint.  By ignoring the call, the data
+        manager can be used with data managers that so support
+        savepoints.
+
+        We return a rollback that raises an error if we call it.
+
+        >>> dm = ZopeDBTransactionManager(None)
+        >>> rb = dm.savepoint(None)
+        >>> rb.rollback()
+        Traceback (most recent call last):
+        ...
+        NotImplementedError: """ \
+           """ZopeDBTransactionManager data managers do not support """ \
+           """savepoints (aka subtransactions
+        """
 
+        return NoSavepointSupportRollback(self)
+    
 
 class Row(object):
     """Represents a row in a ResultSet"""




More information about the Zope3-Checkins mailing list