-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas Jung wrote:
--On 11. Dezember 2005 17:01:56 +0100 "Morten W. Petersen" <morten@nidelven-it.no> wrote:
Hi,
I'm having some code that bombs out trying to commit a transaction; I believe it's because of new ways of doing things in Zope 2.9.. how do you call the equivalents of get_transaction().commit() and abort() in Zope 2.9? Will those new ways work with Zope 2.7/2.8?
See doc/ZODB.txt. Of course the new API will not work in Zope 2.7/2.8.
The 'transaction' module is present in Zope 2.8.x / ZODB 3.4.x. Forward compatibility for third-party produccts which need to work on both 2.7.x and 2.8.x+ usually looks like this: try: import transaction except ImportError: class transaction: """ Forward-compatibility for Zope 2.7.x """ def begin(self): get_transaction().begin() def commit(self, sub=False): get_transaction().commit(sub) def abort(self, sub=False): get_transaction().abort(sub) def savepoint(self, optimistic=None): get_transaction().commit(optimistic and 1 or 0) def get(self): return get_transaction() transaction = transaction() I'll agree with Jim and Morten that the deprecated 'get_transaction()' pattern should *not* have been ripped out in Zope 2.9b1 (2.10 is the earliest feasible point, I think). Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDnG5W+gerLs4ltQ4RAlDCAJ9n1owUWja8VUoYfOA3qXQEwKK/AwCffWDG YbnO+f8tnKilCYQHVnPeYNk= =7HJy -----END PGP SIGNATURE-----