[Grok-dev] Manipulating the Grok ZODB via Script.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jul 12 01:29:09 EDT 2010

> On Jul 12, 2010, at 6:55 AM, Jasper Spaans wrote:
> Op 11 jul 2010, om 15:12 heeft Achim Domma het volgende geschreven:
>> is it possible to run a script against an existing ZODB, using the
>> complete Grok infrastructure? My idea is to fill an empty
>> application with some sample data to be able to "play" with it. I
>> guess I could do it in an event handler for the ObjectCreated event
>> of the application. But that does not feel god to me. Any hint?
>> Sure, not a problem. Start by setting up a connection to your ZODB,
>> and fetching the root object:

Or maybe even easier: use ./bin/interactive_debugger [path/to/script.py]

This command is installed when you create a project with the latest 
grokproject command. In projects created with the earlier grokproject 
versions, most probably ./bin/zopectl run [pah/to/script.py] is available.

These command setup your complete application and make the database root 
object avaialable under the global name "root" in your script.

regards, jw

More information about the Grok-dev mailing list