[schooltool-dev] Fwd: Detecting changes to objects

Ignas Mikalajunas ignas.mikalajunas at gmail.com
Wed Jun 13 06:37:41 EDT 2007


> The current delimma of stAgent is how to know when person objects are
> created/changed/modified. Paul Carduner told me to subcribe to
> IObjectModifiedEvent objects, however I only receive event relating to
> PersonContainer objects (among others) with the following
>
>   <subscriber
>     for="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
>     handler=".handler.someFunction"
>   />
>
> However I found I could narrow the search down to just Person objects
> by adding their interface in the front of the for="". The following
> calls the handler function whenever a Person object is created
>
>   <subscriber
>     for="schooltool.person.interfaces.IPerson
>            zope.lifecycleevent.interfaces.IObjectCreatedEvent"
>     handler=".handler.someFunction"
>   />
>
> Now the problem remains to detect changes and deletions of Person
> objects. Whenever either of those occur, I get an IObjectModifiedEvent
> for PersonContainer, however I have no way of knowing how its objects
> were changed, only that one of them was. The following does not raise
> any events at all
>
>   <subscriber
>      for="schooltool.person.interfaces.IPerson
>             zope.lifecycleevent.interfaces.IObjectModifiedEvent"
>      handler=".handler.someFunction"
>    />
>
> Right now, all I can think of is to keep track of the usernames of all
> Person objects and check that against the usernames whenever an event
> is called to find deleted people. Do any of you have any suggestions?

IObjectRemovedEvent ?

Ignas


More information about the Schooltool-dev mailing list