[ZODB-Dev] zodb connection question

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Tue Jul 12 05:18:16 EDT 2005


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):
        self.reindex_object()

...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:
  /bliss/data/SomeClassObjects/instances/SomeClassInstanceId
the catalog is here:
  /bliss/data/SomeClassObjects/Catalog

i tried

  obj.Catalog
  getattr(obj, 'Catalog')
  obj.unrestrictedTraverse('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: #XLhost at quakenet
WEB:  http://www.XLhost.de


More information about the ZODB-Dev mailing list