[Zope-Checkins] SVN: Zope/branches/2.9/ Collector #1965:
'get_transaction' missing from builtins without sufficient
deprecation notice
Tres Seaver
tseaver at palladion.com
Mon Dec 12 10:06:10 EST 2005
Log message for revision 40728:
Collector #1965: 'get_transaction' missing from builtins without sufficient deprecation notice
o ZODB 3.6 properly removed it, but Zope needs to keep it for another release
because ZODB released *twice* during the Zope 2.9 release cycle.
Changed:
U Zope/branches/2.9/doc/CHANGES.txt
U Zope/branches/2.9/lib/python/Zope2/App/startup.py
-=-
Modified: Zope/branches/2.9/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.9/doc/CHANGES.txt 2005-12-12 14:55:28 UTC (rev 40727)
+++ Zope/branches/2.9/doc/CHANGES.txt 2005-12-12 15:06:09 UTC (rev 40728)
@@ -27,6 +27,10 @@
Bugs fixed
+ - Collector #1965: 'get_transaction' missing from builtins without
+ sufficient deprecation notice (ZODB 3.6 properly removed it, but
+ Zope needs to keep it for another release).
+
- Several zope.app packages were forgotten to be included in the
first beta due to the now zpkg-based build and release process.
Modified: Zope/branches/2.9/lib/python/Zope2/App/startup.py
===================================================================
--- Zope/branches/2.9/lib/python/Zope2/App/startup.py 2005-12-12 14:55:28 UTC (rev 40727)
+++ Zope/branches/2.9/lib/python/Zope2/App/startup.py 2005-12-12 15:06:09 UTC (rev 40728)
@@ -12,6 +12,7 @@
##############################################################################
"""Initialize the Zope2 Package and provide a published module
"""
+import warnings
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
@@ -223,6 +224,7 @@
ac_logger = logging.getLogger('event.AccessControl')
+
class TransactionsManager:
def begin(self,
# Optimize global var lookups:
@@ -290,4 +292,22 @@
T.setUser(auth_user.getId(), auth_path)
+# BBB: older code expects 'get_transaction' to be available in __builtin__.
+def get_transaction():
+ _GET_TRANSACTION_DEPRECATED = """\
+The 'get_transaction' utility function in __builtin__ is deprecated, and
+will be removed in Zope 2.10 (May 2006).
+
+Please import the transaction module, and use transaction.get() instead of
+get_transaction(). transaction.commit() is a shortcut spelling of
+transaction.get().commit(), and transaction.abort() of
+transaction.get().abort().
+"""
+ warnings.warn(_GET_TRANSACTION_DEPRECATED, DeprecationWarning)
+ return transaction.get()
+
+import __builtin__
+__builtin__.get_transaction = get_transaction
+del __builtin__
+del get_transaction
More information about the Zope-Checkins
mailing list