[ZODB-Dev] Context and automatic actions on commit of Persistent object?

Syver Enstad syver at inout.no
Wed Jul 21 05:25:26 EDT 2004


Is there a way to set application specific data on either the
Transaction or Connection object?

The reason why I am asking this is that I have objects that should be
stamped with some information each time they are changed. If the
object itself could access a context object to get hold of this
information itself it would make my application code simpler.

A pseudo code sketch:

class MyPeristentObject(Persistent):
     def __getstate__(self):
        context = self._p_jar.getContext() 
        self._stamp = context.data()
        result = Persistent.__getstate__(self)
        return result

Or is this a bad idea?





More information about the ZODB-Dev mailing list