[Zope] Re: Bulk uploads

Johan Carlsson johanc at easypublisher.com
Wed Sep 1 07:54:25 EDT 2004


cp.hennessy at openapp.biz wrote:

> Maik Jablonski wrote:
> 
> I imagine that there much be an automatic way (or a product for this) but it
> is not obvious to me.

If your implement your own folder you can override the methods for 
WebDAV support (see below).
With CMFs TypeTool You would probably configure the mapping
per site, I'm not sure. Check the CMF source for PUT_factory
or MKCOL_handler.
One problem remains, which is partly a file system clash.

WebDAV client usually doesn't handle collections of different
type, because the only sensible is to map it to a Folder.
Zope can have collections that are not just Folders but
will look like Folders through the client (for instance WebDrive
which I use by the way).
I'm not sure if this limitation is built in to WebDAV as well,
but it's possible (someone from South River Technologies
ones told me otherwice).

Regards,
Johan Carlsson

An example of Colliberty Easy Publishers WebDAV support:

def MKCOL_handler(self,id,REQUEST=None,RESPONSE=None):
     """Handle WebDAV MKCOL."""
     #This adds a new Collection
     self.addNewDocument(id, REQUEST=REQUEST,RESPONSE=RESPONSE)


def PUT_factory( self, name, typ, body ):
     """\
     Dispatcher for PUT requests to non-existent IDs.  Returns
     an object of the appropriate type (or None, if we don't
     know what to do).
     """
     try:
         if name and name.endswith('.pt'):
             ob = ZopePageTemplate(name, body, content_type=typ)
         elif typ in ('text/html', 'text/xml', 'text/plain'):
             ob = DTMLMethod( '', __name__=name )
         elif typ=='text/x-python' or (body and body[0]=='#') \
		or name.endswith('.pys'):
             ob = PythonScript( name )
         elif typ=='text/easydocument' or name.endswith('.edoc'):
             from Products.EasyEditor.EasyDocument import EasyDocument
             ob = EasyDocument( name )
         elif typ=='text/easynewsitem' or name.endswith('.enews'):
             from Products.EasyEditor.EasyNewsItem import EasyNewsItem
             ob = EasyNewsItem( name )
         elif typ=='text/easycontactform' or name.endswith('.eform'):
             from Products.EasyContactForm.EasyContactForm
                 import EasyContactForm
             ob = EasyContactForm( name )
         elif typ[:6]=='image/' or name[-3:].upper()
                 in TYPEINFOMAP.keys():
             ob = EasyImage(name, body, '', content_type=typ)
         else:
             ob = EasyFile(name, body, '', content_type=typ)
     except:
         return None
     return ob




More information about the Zope mailing list