[Zope-CMF] UnpickleableError

Tres Seaver tseaver@palladion.com
Thu, 24 May 2001 13:26:57 -0400 (EDT)


On Thu, 24 May 2001, seb bacon wrote:

> I'm having a really confusing time here, so my explanation /
> plea for help might not make much sense.  It's further
> complicated by the fact I've hacked the source in a few places
> and didn't version control it (I thought it would be a 10
> minute job...:)  If anyone more experienced than I can give me
> their gut feeling about this, though, I'd appreciate it.
> 
> I've fixed a problem stopping you from creating new objects in
> a member's home folder over WebDAV.  All content types are
> created correctly, except File types (which are the default
> type). 

Hmm, I'm creating PortalFile objects via WebDAV against the
current head of CVS.  I do know that they don't get their
'portal_type' set appropriately (so they don't show up in the
'folder_contents' view, and can't find their actions, etc.), but
they do get created.

Wait a minute ...*checks ZMI*... Hmm, what is being created
is *not* a PortalFile instance, but a stock OFS.File;
CMFDefault.File doesn't register with the PUT_factory's MIME type
registry at all.  If I hack CMFDefault.__init__ to register a
given MIMEtype ('application/msword') as mapping to File.File,
the PUT *does* work.

> The only client-side symptom for the failure with these types
> is a 500 Internal Server Error message.  If I go through the
> debugger, I find an UnpickleableError is raised at the point
> where the transaction is committed.  The exc_value is an
> UnpickleableError instance, unhelpfully enough, so I don't know
> much about it.
> 
> I *can* create File types TTW.  I can also confirm that the
> NullResource is correctly using a CMFDefault File factory.  The
> data is being stored in the object correctly; it's just the
> commit which fails.
> 
> The File code is vanilla CMF CVS.  I don't have the problem
> with Images, which use almost indentical code, including the
> same PUT (from OFS.Image).
> 
> What kind of thing causes UnpickleableErrors?  Why would Files
> fail and Images work?  Why would Files fail through WebDAV and
> succeed TTW?  I know these are very vague questions but any
> pointers at all would be useful at this point....

Usually, UnpickleableError means that some "primitive" Python
thing (a file handle is the easiest one to imagine) has gotten
assigned to an attribute (the transitive closure of them) of
a persistent object.

I can't see how the "stock" OFS.File.PUT would do that -- did you
override it?

Tres.
-- 
===============================================================
Tres Seaver                               tseaver@palladion.com