[Zope] unpickleerror confusion

Thomas Guettler zopestoller@thomas-guettler.de
Fri, 19 Apr 2002 08:17:06 +0200


David Bear wrote:

> I was going through the example in the Zope Book (new riders) making
> slight modifications to the code.  Trying to do the example of using a
> post method to create new dtml docs (using python p 84).
> 
> Well, after creating the dtml-doc and method, and the python script, and
> running it, I get the ugly :
> 
> ======================================
> Zope Error
>        Zope has encountered an error while publishing this resource.
>        Error Type: UnpickleableError
>        Error Value: Cannot pickle objects
> Traceback (innermost last):
>   File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module
>   File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 187, in publish
>   File /usr/local/www/Zope/lib/python/Zope/__init__.py, line 226, in zpublisher_exception_hook
>     (Object: LockableItem)
>   File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 175, in publish
>   File /usr/local/www/Zope/lib/python/Zope/__init__.py, line 240, in commit
>   File /usr/local/www/Zope/lib/python/ZODB/Transaction.py, line 302, in commit
>   File /usr/local/www/Zope/lib/python/ZODB/Connection.py, line 418, in commit
>     (Info: (('OFS.DTMLDocument', 'DTMLDocument'), '\x00\x00\x00\x00\x00\x00\x19\xa4', ''))
> UnpickleableError: (see above)
> 
> =========================
> 
> here's the python that is called to save the doc:
> 
> ========py code============
> 
> id='Document_%d' % len(context.objectIds())
> context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title=name, file=abstract)
> doc=getattr(context, id)
> doc.manage_addProperty('Manager', manager, 'string')
> doc.manage_addProperty('StartDate', startDate, 'string')
> doc.manage_addProperty('EndDate', endDate, 'string')
> doc.manage_addProperty('FundingSourse', fundingSource, 'string')
> doc.manage_addProperty('FundingAmount', fundingAmount, 'string')
> doc.manage_addProperty('KeyWords', keywords, string)
> 


maybe startDate is not a string but a object which can't be pickled.

thomas