[Zope] Newbie question about zodb and script (python)

Daniel Tartaglia daniel_t at earthlink.net
Fri Aug 8 00:00:43 EDT 2003


I'm pretty raw with zope so far but I'm trying to save information that 
is entered in a form, into a file. I tried pickling the object from in 
a scrip (python) and when that didn't work (because the shelf module 
was restricted) I tried using zodb instead but that module is 
restricted as well.

I seem to remember reading something about these restrictions and how 
to get around them (something about calling actual python code?) but I 
can't find the reference any more.

I have an zpt form to allow a person to enter his first and last name, 
how do I save the first and last name in a database file? The below 
doesn't work because I can't import FileStorage...

from ZODB import FileStorage, DB

class Person:
	pass

storage = FileStorage( 'allDentest.fs' )
dbase = DB( storage )
connection = dbase.open()
root = connection.root()

# create a unique entry id
id = '%d' % len(entries_folder.objectIds())
	
newDentist = Person()
newDentist.id = len( dbase )
newDentist.firstName = first
newDentist.lastName = last

root[newDentist.id] = newDentist
connection.get_transaction().commit()
connection.close()




More information about the Zope mailing list