hi all!

i'm trying to form a patch that will result in a method "_before_commit()"
being called on each modified object in a transaction (if that method
exists of course) right before commit.
main sense is to automate/delay (re)cataloging.

first i looked at the Transaction class, as there have been heavy
modifications to it from zodb 3.2 to 3.4 i looked around again and
figured the best place to add the hack for testing was
lib/python/ZODB/Connection.py  - i tried to add the following code
snippet to the very beginning of tpc_begin():

    for obj in self._registered_objects:
        hook = getattr(obj, '_before_commit', None)
        if hook is not None: hook()

the effect is that the method gets called correctly on each modified
object (hurray!), but i have another problem:
my _before_index() method is very simple at the moment:

    def _before_commit(self):

...it simply calls reindex_object, inherited from CatalogPathAwareness.
and that does nothing. why? hmm - seems like the object cannot acquire
the Catalog.

here's my folder structure for instances:
the catalog is here:

i tried

  getattr(obj, 'Catalog')

and each of them failed. and here i don't know the answer.
something wrong with my approach? hope somebody can help.

regards, juergen herrmann

>> XLhost.de - eXperts in Linux hosting <<

Juergen Herrmann
Weiherweg 10, 93051 Regensburg, Germany
Fon:  +49 (0)700 XLHOSTDE [0700 95467833]
Fax:  +49 (0)721 151 463027

ICQ:  27139974  -  IRC: [EMAIL PROTECTED]
WEB:  http://www.XLhost.de
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to