[Zope3-dev] events: getting the context of objects
Roger Ineichen
dev at projekt01.ch
Fri May 20 06:24:55 EDT 2005
Hi Jean-Marc
Created object don't have a ILocation.
They have to be added first to a container.
Use ObjectAddedEvent for get a object with a ILocation.
Regards
Roger Ineichen
> -----Original Message-----
> From: zope3-dev-bounces+dev=projekt01.ch at zope.org
> [mailto:zope3-dev-bounces+dev=projekt01.ch at zope.org] On
> Behalf Of Jean-Marc Orliaguet
> Sent: Friday, May 20, 2005 12:16 PM
> To: zope3-dev at zope.org
> Subject: [Zope3-dev] events: getting the context of objects
>
>
> Hi!
>
> I want to get the location about created object through event
> notifications, but there is never enough context (there is
> "Not enough
> context to determine location root", ...)
>
> <subscriber
> handler=".objectevents.objectCreated"
> for="zope.app.event.interfaces.IObjectCreatedEvent"
> trusted="True"
> />
>
>
> def objectCreated(event):
> """event handler
> """
> object = event.object
>
> locatable = IPhysicallyLocatable(object, None)
> if locatable is not None:
> path = locatable.getPath()
> ....
>
> What is missing?
>
> /JM
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub:
> http://mail.zope.org/mailman/options/zope3-dev/dev%40projekt01.ch
>
>
More information about the Zope3-dev
mailing list