[Zope] WebDAV or FTP "type"s?

Ron Bickers rbickers-dated-1008706084.07bddd@logicetc.com
Tue, 11 Dec 2001 15:08:04 -0500


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Derek
> Simkowiak

> I must write my own custom code to do this.  There is
> no config file or U.I. option for specifying what "type" an uploaded file
> is.  Is that true?

That is true, yes.  I thought I read somewhere (or maybe it was in a hopeful
dream) that a future Zope would make this more easily configurable.

> 	If so, my demo schedule just jumped from 3 days to a couple of
> weeks.

Instead of creating a Product, you can just put an External Method in the
root of your site.   Below is one that I use for creating Zope Page
Templates on FTP upload instead of DTML Documents.  You could modify it for
the different content types you're interested in.

The nutshell explanation is that you have PUT_factory return the type of
object you want to create based on the content type of what's being
uploaded.  I don't recall what all the parameters can be used for, but to a
search on PUT_factory and you should find more info.

def PUT_factory(self, name, typ, body):
    """Make Page Template the default type for ftp uploads."""
    from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate

    if typ == 'text/html':
        return ZopePageTemplate(name)
    return None

_______________________

Ron Bickers
Logic Etc, Inc.