[ZODB-Dev] confused... Zope/ZODB

Casey Duncan casey@zope.com
12 Jun 2002 09:14:52 -0400


While you are inside Zope, you are already working inside the ZODB, so
you rarely need to access it directly. Through the web code like Python
scripts is restricted in Zope, so it cannot access arbitrary modules,
only those that do not allow you to subvert security or the Zope
process. In order to have unrestricted access, you must write your code
on the file system.

To do the things you have coded below, you do not need Zope at all, just
the ZODB package. There is a StandaloneZODB package which you can
install in Python to create ZODB applications.

The code you have written could just be placed in a regular Python
module after you install the ZODB package.

hth,

Casey

On Wed, 2002-06-12 at 06:41, Antony Higgs wrote:
> Hi
> 
> ok, i'm new to this Zope/ZODB and am a bit confused. ;-)
> 
> - ZODB comes with zope?
> 
> - You can do ZODB things from a Zope script (python) page?
> 
> - If so, I am having trouble doing anything with it. I have been working
> through a tutorial which creates storage stores some info and then looks
> to see what you have just stored.
> 
> create the storage and add info
> ----------------------
> from ZODB import FileStorage, DB
> storage = FileStorage.FileStorage('mydb.fs')
> db = DB(storage)
> connection = db.open()
> root = connection.root()
> 
> root['employees'] = ['Mary','Jo','Bob']
> get_transaction().commit()
> ----------------------
> 
> connect to DB and see what's in it
> ----------------------
> from ZODB import FileStorage, DB
> storage = FileStorage.FileStorage('mydb.fs')
> db = DB(storage)
> connection = db.open()
> root = connection.root()
> 
> root.items()
> ----------------------
> 
> The first section of code gives a Zope error:
> 
> Error Type: ImportError
> Error Value: import of "FileStorage" from "ZODB" is unauthorized
> 
> 
> Am I on another planet with my thinking?
> 
> 
> Thanks
> 
> John
> 
> 
> 
> 
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev