Commit b3059f1b authored by Tres Seaver's avatar Tres Seaver

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.
parent d8323a18
...@@ -27,6 +27,10 @@ Zope Changes ...@@ -27,6 +27,10 @@ Zope Changes
Bugs fixed 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 - Several zope.app packages were forgotten to be included in the
first beta due to the now zpkg-based build and release process. first beta due to the now zpkg-based build and release process.
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
############################################################################## ##############################################################################
"""Initialize the Zope2 Package and provide a published module """Initialize the Zope2 Package and provide a published module
""" """
import warnings
from AccessControl.SecurityManagement import getSecurityManager from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
...@@ -223,6 +224,7 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback): ...@@ -223,6 +224,7 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
ac_logger = logging.getLogger('event.AccessControl') ac_logger = logging.getLogger('event.AccessControl')
class TransactionsManager: class TransactionsManager:
def begin(self, def begin(self,
# Optimize global var lookups: # Optimize global var lookups:
...@@ -290,4 +292,22 @@ class TransactionsManager: ...@@ -290,4 +292,22 @@ class TransactionsManager:
T.setUser(auth_user.getId(), auth_path) 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment