Sotring __of__(self) wrapped Objects OK? (was Re: [Zope-dev] Storing references ... accross requests)

Dario Lopez-Kästen dario at ita.chalmers.se
Thu Jun 17 05:01:58 EDT 2004


[ resend - never got to the list ]

Dieter Maurer wrote:
> Your problem can be summarized by "storing acquisition wrappers
> (of persistent objects) across requests".
> 
<...>
> You cannot store them in the ZODB as acquisition wrappers cannot
> be stored there. Currently, the ZODB silently unmantles
> acquisition wrappers. They may be rebound on access -- but
> this will not give you the original acquisition context and
> behaviour can be drastically different.

hello, again,

I have rearranged in my product now, so that I pass along dictionaries
to populate the classes and using a cmf-tool to provide the interface
for the various methods of the classes.

I am returning objects wrapped in __of__(self), ie.

    class Person(Acquisition.Implicit):
       def __init__(self data):
           ...

    PersonObject = Person(data).__of__(self)
    return PersonObject

If I want to pickle, store and later reuse PersonObject, I suspect that
this also creates a similar to my original one, where I wanted to store
ZODB-references in the PersonObject.


So should I, when pickling and storing the PersonObject, store

   PersonObject.aq_base

rather than just PersonObject?

Thanks,

/dario

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





More information about the Zope-Dev mailing list