[Zope-dev] Re: [Zope-CMF] Managing Modification/Creation Dates

Toby Dickenson tdickenson@geminidataloggers.com
Sat, 29 Jun 2002 18:56:44 +0100


On Saturday 29 Jun 2002 5:51 pm, Florent Guillaume wrote:
> [Redirecting to zope-dev]
>
> Carl Rendell  <cer@sol43.com> wrote:
> > Has anyone on the list ever 'set' the modification or other date
> > attributes on an object in the ZODB? I've looked at the
> > bobobase_modification_time() call and found it looks at an
> > attribute [_p_mtime] for an object, but have yet to discover what
> > controls the setting of that attribute, or if that is the attribute
> > to set?
> >
> > I'm familiar with changing these on items in a file system, but
> > performing the same task on an object in the ZODB has me stumped
> > right now.
>
> I looked a few weeks ago, and it's deep in the C code, and grep-proof
> besides :-) Look in ZODB/cPersistence.c, grep for "'m'" (with single
> quotes).
>
> My conclusion was that it was very tied to the ZODB and that setting
> it would probably break the serial or transaction mechanisms.

That conclusion is correct. _p_mtime is the timestamp of the transaction =
from=20
which that object was loaded. It is used at the end of a transaction if y=
ou=20
modified an object, to verying that there has not been a newer revision o=
f=20
the object since the one that was modified.

If you want to define your own modification time behaviour, the recommend=
ed=20
approach is to define your own seperate attribute.