[Schevo-devel] Using a Schevo database from the Python shell

Patrick K. O'Brien pobrien at orbtech.com
Tue Apr 19 17:15:50 EDT 2005


I just enhanced evo to make it easier to open up a Schevo database from
the Python shell, with no gui or web interface at all.  This should make
it easier for anyone who wants to play with low-level Schevo
functionality.  When I have time I'll try to write about all the things
you can do from the shell.  In the mean time, here is a very simple
example session to get you started:

C:\Demos>evo new --template=todo myapp
INFO:root:Creating myapp
INFO:root:Creating myapp.__init__
INFO:root:Creating myapp.config
INFO:root:Copying todo template to myapp

C:\Demos>evo run myapp -- --no-navigator
INFO:root:Reading application configuration.
INFO:root:Configuration bootstrapped.  Restarting...
INFO:root:Reading application configuration.
INFO:root:Created new storage directory: C:\Demos\myapp\store
INFO:root:Opening the database...
INFO:root:Using schemata 0
INFO:root:Database evolved to schemata 1
INFO:root:Database opened.
INFO:root:Loading icons...
INFO:root:Icons loaded.
INFO:root:Starting the UI...
INFO:root:Starting services...
INFO:root:Services started.
INFO:root:Populating database with sample data...
INFO:root:Database populated with sample data.
INFO:root:Running the application...
INFO:root:Main loop terminated.
INFO:root:Dropping into the Python shell...
>>> db
<schevo.database.database.Database object at 0x0167A350>
>>> db.root
<schevo.database.database.RootProxy object at 0x0167A230>
>>> db.admin
<SchevoDatabaseAdministration object at 0x166dc30>
<schevo.database.database.Database object at 0x0167A350>
>>> people = db.root['Person']
>>> for person in people:
...     print person.name
...
Jane Doe
John Doe
Betty Rubble
Barney Rubble
Fred Flintstone
Genderless Doe
>>> ^Z

INFO:root:Database closed.

C:\Demos>

Hmmm.  Now what I'd really like to do is add PyCrust as an interface
option...

-- 
Patrick K. O'Brien
Orbtech    http://www.orbtech.com
Schevo     http://www.schevo.org
Pypersyst  http://www.pypersyst.org




More information about the Schevo-devel mailing list