[Grok-dev] Manipulating the Grok ZODB via Script.
jcerjak at termitnjak.si
Mon Jul 19 12:24:58 EDT 2010
On 07/17/2010 05:36 PM, Jan-Wijbrand Kolman wrote:
>> I tried this script method, the method with an event handler for the
>> ObjectCreated event of the application and creating the objects in
>> __init__ method of my app, but in all cases the newly created objects
>> didn't get an IntId assigned, which happens normally if I create an
>> object with an AddForm. I thought that maybe I have to trigger the
>> appropriate events manually with grok.notify, but that didn't help. Can
>> you help a brother out?
> Isn't it the ObjectAddedEvent that'll trigger the intid assignment? So,
> what happens if you add the object you created in the script, to a
> regards, jw
> Grok-dev mailing list
> Grok-dev at zope.org
ok, i'm getting some weird KeyError-s, if I try to create a container in
the script, which I run with bin/interactive_debugger.
root = conn.root()
myapp = root['myapp']
myapp['newfolder'] = grok.Container()
throws KeyError: u'newfolder' .
I would rather run this setup code in an event handler anyway, so guess
I should wait for the new grok release and the
grok.IApplicationInitializedEvent ? Creating new objects in the
ObjectAdded or ObjectCreated event handler for the app probably isn't
the best idea. The ObjectAddedEvent is fired when I add the objects to a
container, but something else goes wrong along the way, because they
don't get an IntId..
Is it possible to use the new grok.admin without breaking something else?
More information about the Grok-dev