----- Original Message ----- From: "David Bear" <[EMAIL PROTECTED]>
To: "zope" <Zope@zope.org>
Sent: Thursday, October 25, 2007 6:19 PM
Subject: [Zope] storing python objects


I need to run an external method to use some python functions that are
restricted within zope. I'm thinking an easy way to get the data back
would be to just store basic python objects within zodb; tupples,
lists, dictionaries.

but I've never seen this documented anywhere. Is it possible to store
basic python objects directly in zodb? AND then use a zpt to read the
data?

I'm thinking a simple thing would be to create an external method that
returns a dictionary.

Then I could have script call the method, and stored the dictionary on
zodb.

I have done something similar: have an external method store a a list/dictionary value in a property field on a folder, then a future call to the external method retrieves that property field and uses 'eval' to convert it back to a list/dictionary (it is stored as a string). *** Warning: You need to be 100% sure you know what is in the list/dictionary if you are going to use 'eval' though!

The other approach I have used is to create a dead simple Zope product that just defines an object class (which contains lists, dictionaries, etc) and then have the external method store these objects directly in the ZODB.

Jonathan

_______________________________________________
Zope maillist  -  Zope@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 )

Reply via email to