Hi,

In my eXtremeManagement product I have a folderish content type Task.
It can contain another content type Booking.  Both are based on
Archetypes.

I am now experimenting on a branch with zope 3 events.  When I add a
Booking (with hours/minutes worked) to a Task I want to update a field
of the Task that holds the total time for all its Bookings.  I seem to
have that working nicely now.  It also works when moving or removing
that Booking.

But when I *change* the Booking ("oops, I wanted to book 1 hour, not
2") that total needs to be updated as well.  IObjectModifiedEvent
seems the correct event to subscribe to for this.  But then I lack
some info.  When that event fires it gives me the new object with the
new hours and minutes of that Booking.  But I do *not* know their
previous settings.  So I do not know how much time to add or subtract
from the total in the parent Task.

One option here is to set that total to zero, get all Bookings from
that Task and add them up.  I guess that is my best option now.  It
does not strike me as very elegant though, but if it works, it works
of course.

But I wonder if there are other options.  The event has a tuple
descriptions that could contain some hints of the changes, but that is
empty.  The event does not have something like oldObject and
newObject.  Is anything like that available?  Maybe in newer versions
of Archetypes, Zope or Plone?

Using Zope 2.9, Plone 2.5 here.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to