[Zope3-Users] Re: Function that is called when object is fully instantiated

Fred Drake fdrake at gmail.com
Mon Nov 20 22:08:21 EST 2006


On 11/20/06, Florian Lindner <mailinglists at xgm.de> wrote:
> I use is this way:
>
> def onObjectAdded(event):
>     if IJabberClient.providedBy(event.object):
>         event.object.finishInitialization()
>
> the function is outside the class and is registered as a subscriber for
> IObjectAddedEvent

This could be made a handler for [IJabberClient, IObjectAddedEvent],
and skip the providedBy() test in the handler.

> but inside finishInitialization there are still no values from the schema set
> to the values I entered on the web-form. There are still at the default
> values I set them like that: (var1 and var2)

Are you using browser:addform?  There are four different attributes
that can be used to tailor when attributes of the object are set:
arguments, keyword_arguments, set_before_add, and set_after_add.
Fields that are input but not included in any of these are set after
adding the object to it's container.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
"Every sin is the result of a collaboration." --Lucius Annaeus Seneca


More information about the Zope3-users mailing list