[Zope] Document last modified by?

Jim Fulton jim@digicool.com
Tue, 14 Sep 1999 14:43:11 +0000


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

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.