Commit 64a86e6f authored by Tim Peters's avatar Tim Peters

The old commit hook spelling will actually be removed

in 3.8 (it didn't get released in ZODB 3.5; will be
released in ZODB 3.6).
parent 51003b4f
......@@ -39,6 +39,7 @@ __all__ = ['z64',
'DEPRECATED_ARGUMENT',
'deprecated36',
'deprecated37',
'deprecated38',
'get_pickle_metadata',
]
......@@ -65,6 +66,13 @@ def deprecated37(msg):
warnings.warn("This will be removed in ZODB 3.7:\n%s" % msg,
DeprecationWarning, stacklevel=3)
# Raise DeprecationWarning, noting that the deprecated thing will go
# away in ZODB 3.8. Point to the caller of our caller (i.e., at the
# code using the deprecated thing).
def deprecated38(msg):
warnings.warn("This will be removed in ZODB 3.8:\n%s" % msg,
DeprecationWarning, stacklevel=3)
z64 = '\0'*8
assert sys.hexversion >= 0x02030000
......
......@@ -430,9 +430,9 @@ class Transaction(object):
self._before_commit_index += 1
def beforeCommitHook(self, hook, *args, **kws):
from ZODB.utils import deprecated37
from ZODB.utils import deprecated38
deprecated37("Use addBeforeCommitHook instead of beforeCommitHook.")
deprecated38("Use addBeforeCommitHook instead of beforeCommitHook.")
# Default order is zero.
self.addBeforeCommitHook(hook, args, kws, order=0)
......
......@@ -167,11 +167,11 @@ class ITransaction(zope.interface.Interface):
raise an exception, or remove `<name, value>` pairs).
"""
# deprecated37
# deprecated38
def beforeCommitHook(__hook, *args, **kws):
"""Register a hook to call before the transaction is committed.
THIS IS DEPRECATED IN ZODB 3.5. Use addBeforeCommitHook() instead.
THIS IS DEPRECATED IN ZODB 3.6. Use addBeforeCommitHook() instead.
The specified hook function will be called after the transaction's
commit method has been called, but before the commit process has been
......
......@@ -436,7 +436,7 @@ class BeforeCommitHookTests(unittest.TestCase):
self.assertRaises(ValueError, t.addBeforeCommitHook,
hook, order=foo())
# deprecated37; remove this then
# deprecated38; remove this then
def test_beforeCommitHook():
"""Test beforeCommitHook.
......@@ -474,7 +474,7 @@ def test_beforeCommitHook():
1
>>> message, category, filename, lineno = whook.warnings[0]
>>> print message
This will be removed in ZODB 3.7:
This will be removed in ZODB 3.8:
Use addBeforeCommitHook instead of beforeCommitHook.
>>> category.__name__
'DeprecationWarning'
......
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