[Zope-CMF] Re: [dev] failing tests and other unit test issues
yuppie
y.2005- at wcm-solutions.de
Mon Apr 4 13:22:28 EDT 2005
Hi Florent!
Florent Guillaume wrote:
> yuppie <y.2005- at wcm-solutions.de> 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
More information about the Zope-CMF
mailing list