----- Original Message ----- From: "Ron Bickers" <rbickers-dated-1008706084.07bddd@logicetc.com> To: "Derek Simkowiak" <dereks@realloc.net>; "Andreas Jung" <andreas@zope.com> Cc: <zope@zope.org> Sent: Tuesday, December 11, 2001 15:08 Subject: RE: [Zope] WebDAV or FTP "type"s?
-----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
Excellent solution ! Andreas