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()

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to