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

Florian Lindner mailinglists at xgm.de
Mon Nov 20 17:21:36 EST 2006


Am Montag, 20. November 2006 07:08 schrieb Jürgen Kartnaller:
> Hi Florian.
>
> Wouldn't be ObjectAddedEvent perfect for this ?

Mmmhh....

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

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)

class bla(Pesistent, Contained):
  implements(IBla)

  var1 = u""
  var2 = True


in IBla they are declared:

var1 = TextLine(
                        title = u"var1",
                        description = u"...",
                        required = True )
                        
var2 = Bool(
                        title = u"var2",
                        description = u"...",
                        default = True)

What is wrong?

Thanks,

Florian


More information about the Zope3-users mailing list