I am running Zope2.2.2 under python1.5.2 on a linux machine.
The following situation:

I have an external Method 
which creates dynamically an instance from of a class depending on 
some input to a function contained in this method.
In short the code (of the external method)

class Classname:
  def function1
  def function2

def createInstance(argument)
 x = Classname(argument) 
 return x

Where createinstance is the method that is invoked initially from zope.
Everything works fine, the method returns something like 
<?.Classname instance at  8546e70>
using "__allow_access_to_unprotected_subobjects__ = 1" 
in the class definition it is possible to access all methods of the class
within Zope.
Among others the class holds a method 'dump' who should 'pickle' the 
objects instance (using the python 'pickle' module), more precise 
should return a string represantion of itself.
This works fine when tested in a normal python session. 
(where the method returns contrary to above:
<__main__.Classname instance at .......>) 
Called from Zope this does not work. The pickle module raises an 
  File /usr/lib/python1.5/, line 818, in dump
  File /usr/lib/python1.5/, line 97, in dump
  File /usr/lib/python1.5/, line 198, in save
  File /usr/lib/python1.5/, line 400, in save_inst
  Error type: Attribute error, Error Value: __module__

QUESTION: Is there any possibility to get these things work. ?
 (or is it really awkward stuff ???)

Maybe related questions:
QUESTION 2: What does the "?" mark in the generated objects string
representation means ? 
Is it neccessary to 'anchor' (sorry for my terminology) the object within some 
other object ? And:

QUESTION 3: The lifetime of an instance has should not to be longer than 
the current REQUEST is performed,  is there any possibility to
create the instance as an subobject of the current REQUEST ?? 

Any help and advice would be highly appreciated...



Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to