[Zope-Checkins] SVN: Zope/branches/2.9/ Collector #1965: 'get_transaction' missing from builtins without sufficient deprecation notice

Tim Peters tim.peters at gmail.com
Mon Dec 12 11:04:14 EST 2005


[Tres Seaver]
> 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
>
> -=-
...
> --- 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)
...

> +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)

Tres, you probably want to supply a stacklevel=2 argument here, so
that the warning points to the code _calling_ get_transaction()
instead of to the warnings.warn() line itself.


More information about the Zope-Checkins mailing list