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

Andreas Jung andreas at andreas-jung.com
Fri Aug 8 07:22:33 EDT 2003


PythonScripts are restricted !
See lib/python/Products/PythonScripts/README.txt
Use ExternalMethods to run Python code with restrictions.

-aj

--On Donnerstag, 7. August 2003 23:00 Uhr -0400 Daniel Tartaglia 
<daniel_t at earthlink.net> wrote:

> 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()
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )







More information about the Zope mailing list