Hi Florent!


Florent Guillaume wrote:
yuppie  <[EMAIL PROTECTED]> wrote:

3.) Zope 2.8 warnings

'Zope2' is not available in Zope 2.7 and 'Zope' is deprecated in Zope 2.8. Same with 'transaction' and 'get_transaction'.

Has anybody a better idea to resolve it than this way:
[...]
I was thinking of:

try:
    import transaction
except ImportError:
    # BBB: for Zope 2.7
    class BBBTransaction:
        def begin(self): get_transaction().begin()
        def commit(sub=False): get_transaction().commit(sub)
        def abort(sub=False): get_transaction().abort(sub)
    transaction = BBBTransaction()

And just use transaction.begin() everywhere in the code.

I like that idea and plan to use it with two small modifications:

1.) fixing the bugs in BBBTransaction ;)

2.) adding BBBTransaction to CMFCore.tests.base.utils and using this in tests:

try:
    import transaction
except ImportError:
    # BBB: for Zope 2.7
    from Products.CMFCore.tests.base.utils import transaction


Cheers,

        Yuppie

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to