Garrett Smith wrote:

What is the difference between 'content' that gets modified and the
object that gets modified.


In my understanding the difference stems from the filesystem
metaphor behind Zope. The "content" of a Zope object corresponds
to the content of a file, while other attributes are more like descriptive
metadata (e.g. modification time).
The distinction however is not clear cut because content objects
can be much more complex than simple files and metadata can also be stored
in annotations.

In my use case, however, it makes sense to draw such a distinction
because I'm using the filesystem to store versions.
Content in this sense is simply that what can be edited by opening and writing files.
Since Zope3 supports WebDAV and FTP something similar is probably needed for
other systems too.

But I could also live with ObjectModifiedEvents only.  
I've to check all aspects of an object anyway, because
the non-content parts of an object are versionable too. Currently I loop over
all versionable attributes (which are provided by special adapters) and
try to detect all differences between new and old versions of an object.

A more radical approach would be to specify in each ObjectModifiedEvent
which aspects of an object changed. By aspect I mean the schema and the modified
field within the schema:

        class IPerson(Interface) :
               age = Attribute("The age of the person")

        class Person(object) :
               implements(IPerson)

        person = Person()
        person.age = 42
        zope.event.notify( ObjectModifiedEvent(person, aspect=IPerson["age"]))

File content then could be handled as a special case :
        
        file.data = "">         zope.event.notify( ObjectModifiedEvent(person, aspect=IFile["data"]))

With this extension the ObjectModifiedEvents would be more informative and a loop over all versionable
attributes in my application would become unnecessary.  This would also make updates of
 catalogs more efficient.

Regards
Uwe Oestermeier
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to