[Zope] Error Value: can't pickle function objects

Mohamed Lrhazi mohamed at your-site.com
Fri May 28 14:35:11 EDT 2004


I am learning more and more... getting there :)

Thanks a lot Alec.

Mohamed~


--On Friday, May 28, 2004 11:07 AM -0700 Alec Mitchell <apm13 at columbia.edu> 
wrote:

> On Friday 28 May 2004 10:15 am, Mohamed Lrhazi wrote:
>> When I replace :
>>
>> self.domain = self.ddb.getDomain(REQUEST['YSURLARGS'][1])
>> self.domainTitle=self.domain.getHTMLDomainName()
>>
>> with this:
>>
>> domain = self.ddb.getDomain(REQUEST['YSURLARGS'][1])
>> self.domainTitle=domain.getHTMLDomainName()
>>
>> It works.
>>
>> "domain" above is an instance of a class called Domain, I defined it in a
>> module that lives in /usr/local/zope/lib/python/YSDomain and that does
>> not implement nor extend any Zope classes or interfaces...
>>
>> Why does instantiating such an object inside my zope application cause
>> "can't pickle function objects" error?
>
> By setting self.domain you are causing the 'domain' instance to be stored
> in  the ZODB, as an attribute of your persistent class.  There is
> apparently some  aspect of that 'domain' instance which is not picklable.
> Unless you really  wanted to store/update an instance of that class in
> the ZODB as an attribute  of your Zope object every time you called
> index_html, the second method is  certainly best.  Updating that
> attribute on every call could result in  tremendous database bloat.
> Actually, it seems pretty strange that you are  setting any instance
> attributes during the index_html call, which one  wouldn't normally
> expect to have any side effects.
>
> Alec Mitchell







More information about the Zope mailing list