[Zope] ExtFile/ExtImage in Zope2 2.13 and Transaction Manager

Jesus Cea jcea at jcea.es
Sat Nov 16 03:49:16 CET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I did some tests a year ago about upgrading to 2.13.19. I use
ExtFile/ExtImage extensively and I had to patch it a bit.

I hit the problem that ExtFile tries to import "from Shared.DC.ZRDB.TM
import TM". Messing around a bit, I solved the issue installing
"Products.ZSQLMethods" product (via
<https://mail.zope.org/pipermail/zope/2012-January/176324.html>), but
this is not working with 2.13.21. I am getting tons of upgrade
warnings about zope packages.

The documentation for "Products/ExtFile/TM.py" says this:

"""
TMRegistry and ProxyTM

Use case
- --------

Persistent objects (ExtFiles) need to participate in ZODB transactions.
ExtFiles perform all operations using temporary files which are saved on
commit or deleted on abort.

Constraints
- -----------

- - TransactionManagers (TM) must not be persistent themselves, i.e. must
  not have a _p_jar attribute.

- - We have to make sure the ExtFile's _abort is called *before* the ZODB
  destroys the attributes of the persistent object.

Solution
- --------

- - ProxyTM is a subclass of TM.TM that keeps a (hard) reference to the
  (wrapped) persistent object it manages. Calls to _begin, _finish, and
  _abort are forwarded to the target object.

- - TMRegistry is a module-level container for ProxyTMs. It creates and
  holds ProxyTMs keyed by (target_id, thread_id).

- - ExtFiles implement _finish and _abort and register with the machinery
  by calling TM.register(self).

- - On commit (or abort) the ProxyTM notifies its target object and removes
  itself from the registry.

Hacks
- -----

- - We manipulate the transaction's _resources attribute directly. This is
  to guarantee the ProxyTM is processed before other resources. There may
  be a way to achieve this using official APIs only, but I can't seem to
  find one.

"""

How can I solve this?. Is there any product similar to
ExtFile/ExtImage? I can program Python if somebody guides me around
the zope2 internal details...

- -- 
Jesús Cea Avión                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
Twitter: @jcea                        _/_/    _/_/          _/_/_/_/_/
jabber / xmpp:jcea at jabber.org  _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQCVAwUBUobdLJlgi5GaxT1NAQJCbgP/cjU/H48QqZar3/quLDGRdTEBt+5uhIve
zf5SLjWnDDqcDQ0UgEhDm7BbAFC4wLDFL8TV0sP7+jCIrvqT/1P9IXUXJ13o9flV
dW2ni1DILG2zD4G3pES9OQKcMyaoXeZT3/JYwB/KD+TXEnDkek1zCxwRAAdRWveh
PeTL6HCbrWU=
=P7r7
-----END PGP SIGNATURE-----


More information about the Zope mailing list