[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. Then have a zpt publish the dictionary. Is this even easily possible, or are there alternatives to doing something similar? -- David Bear phone: 602-496-0424 fax:602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 Beware the IP portfolio, everyone will be suspect of trespassing ___ 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 )
Re: [Zope] storing python objects
- 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 )
Re: [Zope] storing python objects
On Thu, Oct 25, 2007 at 03:19:10PM -0700, David Bear wrote: but I've never seen this documented anywhere. Is it possible to store basic python objects directly in zodb? http://www.zope.org/Documentation/Books/ZDG/current/Persistence.stx -- Paul Winkler http://www.slinkp.com ___ 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 )
Re: [Zope] storing python objects
--On 25. Oktober 2007 15:19:10 -0700 David Bear [EMAIL PROTECTED] wrote: 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. If you need to have this stored on a per-user basis: use sessions. If you need to have this stored as a cache: use one of the existing caches in Zope (RAMCache). -aj pgpqDO76ohfV3.pgp Description: PGP signature ___ 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 )