[Zope-dev] Storing references in objects accross requests - bad or OK?

Dario Lopez-Kästen dario at ita.chalmers.se
Sun Jun 13 06:43:15 EDT 2004


hello,

I am am worrying a problem here, where I need to store references to 
objects in my own objects, while at the same time needing to store and 
retreive my objects later.

Here is an example of what I need to do:

in a product BooTool for Zope I have:

----
class Foo:

   def __init__(self, data, ref_a):
     self.data = data
     self.a_handle = ref_a
     self.stuff = []

   def bar(self):
     # do something with self.stuff
     cool = self.a_handle('one')
     self.stuff.append(cool)
     return self.stuff

def getStuff(data, ref_a):
   """ his method is available to Zope from the tool boo_tool """
   return Foo(data, ref_a)
----

in a python script I have a pythonscript:

----
my_ob = context.boo_tool.getStuff('123', container.my_script)
return my_ob
----

so my_ob contains a reference to the my_script Pythonscript/ZSQL Method.

What happens if I store my_ob in a session storage for instance and 
later retrieve it and do my_ob.bar() ?

What bad things can happen?

Thanks for any input.

/dario

-- 
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.




More information about the Zope-Dev mailing list