[Zope3-Users] Re: are you one example to add a content component in root ZODB folder in interactive command ?

Volker Bachschneider vbachs at dzug.org
Thu Sep 28 11:28:01 EDT 2006


Philipp von Weitershausen schrieb:
> KLEIN Stéphane wrote:
>> are you one example to add a content component in root ZODB folder in
>> interactive command because I don't understand how it work.
> 
> $ bin/debugzope
>  >>> from worldcookery.recipe import Recipe
>  >>> root['chicken'] = Recipe()
>  >>> import transaction
>  >>> transaction.commit()

verbose:
/pathto/zopeinstance/bin/zopectl debug

 >import transaction
 >from zope.event import notify
 >from zope.lifecycleevent import ObjectCreatedEvent
 >from zope.app.component import hooks
 >from zope.app.myproject.myclass import MyContent
 >
 >hooks.setSite(app.root())
 >home = hooks.getSite()
 >
 >transaction.begin()
 >mycontent = home['objectid'] = MyContent()
 >mycontent.attribute1 = u'ContentAttribute'
 >...
 >notify(ObjectCreatedEvent(mycontent))
 >transaction.commit()



More information about the Zope3-users mailing list