[Zope] Is there a "last_modified_by" attribute in DTML

Chip Vanek chip@upcast.com
Thu, 20 Apr 2000 15:50:50 -0700


Hi,

I found an old mail list item talking about a new function
and just want to know if it now exists.  I want to keep
track of who modified some items along with the time and
original creator.

Tanks for any pointers,

Chip Vanek
e-Mail: chip@upcast.com


Jim Fulton wrote:

Ben Leslie wrote:
>
> Hi everyone,
>
> I hope someone could be able to help me here. I have quite a few people
> working out with me on a website I am creating. I would like to be able
> to track who last modified a certain page (not really a 'big brother'
> thing just useful).
>
> I was wondering if there was a way to be able to find out who last
modified
> a page.

Yes, but not as easily as there should be, and only from Python.

ZODB3 exposes two interfaces for doing this.  You should be
able to:

 db=aDocument._p_jar.db() # Get the database the object came from
  history=db.history(aDocument._p_oid, size=9999)

To get a sequence of history entries with information on
when changes were made, by whom, in what version, description
etc. See:

http://www.zope.org/Documentation/Models/ZODB/ZODB_Architecture_DB_history--
Callable_Doc.html

Unfortunately, this method isn't implemented yet. :(
I skipped over it early on and never got back to it.
I'll try to get this done for Zope 2.1 (or Zope 2.0.1).
I've submitted this bug to the collector.

You might also use the undo log with something like:

 db=aDocument._p_jar.db() # Get the database the object came from
  log=db.undoLog(0,9999,
                 lambda u, db=db:
                 string.find(u['description'], db.absolute_url(1))==0
                 )

This will return a sequence of transaction log entries for
methods on the document. See the undo section in the
ZODB model at:

http://www.zope.org/Documentation/Models/ZODB

Now, both of the suggestions above only work if you are
using a ZODB storage that supports undo and they only show
records that haven't been removed by packing. (Actually,
undoLog only shows records that are undoable, which is not all
records).

In the future:

 - An auditing UI of some sort will be added that
    calls these methods for you and,

 - An optional feature will be added in storages
    to save auditing information in such a way that it
    is available independent of packing.

Jim