[Zope-CMF] when is put_factory called?

Tres Seaver tseaver@palladion.com
Tue, 31 Jul 2001 22:43:39 -0400


Robert Rottermann wrote:

> I would like to create a "file type sensing" folder.
> 
> As I understand it is the put_factories job to set the content type when a
> file is uploaded by ftp.


Correct.  Zope's WebDAV machinery looks for a method called 'PUT_factory'
when a PUT is done to a non-existent resource.  If found, the NullResource
calls the method, passing the name, content type, and body of the PUT;  the
method is expected to instantiate and return a new object of an appropriate
type, which the NullResource then sticks into its own slot in its folder and
hands off the remainder of the PUT.


> I set breakpoints in all of the put_factories (skin tool and portal_folder),
> however none of them is reached.


I can't reproduce this at all.  I edited CMFCore.PortalFolder.py, and
added the following line at the beginning of PortalFolder.PUT_factory:

   import pdb; pdb.set_trace()

When I run Zope in debug mode, and FTP into a CMFSite, any PUT operation
to a new filename triggers the breakpoint.


> where is my mistake?
 

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com