Hello Philipp!

> 1. Since ZODB does not overwrite objects on change one can get the older versions 
>when undoing the changes.
>     My question now: how can I access older versions of objects without undoing 
>transactions? (I had a short glance at the ZODB classes, but found nothing)

The code for the History functionality is in History.py, which is located in
the .../lib/python/OFS directory of a Zope 2.2.x installation. It is currently
used by DTMLDocument .py and DTMLMethod.py (both also in OFS) and implements
the history tab functionality for the management interface.

As the actual implementation is plain simple (import History, add
"History.Historical" to the class definitions and 
"+History.Historical.manage_options" to the manage_options), I patched my
Image.py, which defines the classes for images and files, accordingly. The only
thing that won't work right "out of the box" is the "Compare" option - you'd
have to implement document-specific comparison code. I don't know if it is that
easy to do the same patch with ZClasses, but it might be worth a try (I guess
patching the necessary base classes should work).

As you can script everything in the management interface, this patch makes all
your file/image objects' old versions accessible, including date of change and
id of the person who changed.

I think it would also be possible to look at what History.py is doing and
implement the functionality you need without the "overhead" of patching the
object classes. I didn't check in detail, but all you need seems to be there
(or should be found in some ZODB documentation).



Content-Type: text/html; name="unnamed"
Content-Transfer-Encoding: 7bit

Iuveno - Smart Communication

Joachim Werner


Marie-Curie-Straße 6
85055 Ingolstadt

Tel.: +49 841/90 14-325 (Fax -322)
Mobil: +49 179/39 60 327
WWW: www.iuveno.de/www.iuveno-net.de

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to