WebDAV or FTP "type"s?
I asked this before, as part of a longer email, but got no response. How do I specify the "type" for objects which are uploaded via WebDAV or FTP? That is, I want *.html (or *.css or *.js) to be something other than a DTML Document (or DTML Method). Where do I specify that? Also, I want *.jpg and *.gif to be something other than "Image". This is the core question for using Zope to solve my clients' problem. Thank You, Derek Simkowiak dereks@realloc.net
Storing files through FTP/WebDAV workes in the same way as PUT requests using HTTP (because FTP requests are masqueraded as HTTP requests inside Zope). For your purpose I would write a small Product that subclasses OFS.Folder and overrides either PUT() or PUT_factory() to handle the storage of the documents on your own. Look either in the .py files in lib/python/OFS for examples or in the CMF sources. Andreas --------------------------------------------------------------------- - Andreas Jung Zope Corporation - - EMail: andreas@zope.com http://www.zope.com - - "Python Powered" http://www.python.org - - "Makers of Zope" http://www.zope.org - - "Life is a fulltime occupation" - --------------------------------------------------------------------- ----- Original Message ----- From: "Derek Simkowiak" <dereks@realloc.net> To: <zope@zope.org> Sent: Tuesday, December 11, 2001 13:52 Subject: [Zope] WebDAV or FTP "type"s?
I asked this before, as part of a longer email, but got no response.
How do I specify the "type" for objects which are uploaded via WebDAV or FTP? That is, I want *.html (or *.css or *.js) to be something other than a DTML Document (or DTML Method). Where do I specify that?
Also, I want *.jpg and *.gif to be something other than "Image".
This is the core question for using Zope to solve my clients' problem.
Thank You, Derek Simkowiak dereks@realloc.net
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-> For your purpose I would write a small Product that -> subclasses OFS.Folder and overrides either PUT() or PUT_factory() -> to handle the storage of the documents on your own. -> Look either in the .py files in lib/python/OFS for examples or -> in the CMF sources. Ack! You just stepped WAY beyond my level of Zope expertise. Before I dive into (a) how to create a Product, (b) the PUT() and PUT_factory() APIs, and (c) the OFS and/or CMF sources, I just want to confirm one thing: 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? If so, my demo schedule just jumped from 3 days to a couple of weeks. Thanks, Derek Simkowiak dereks@realloc.net
-----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.
----- 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
On Tue, 2001-12-11 at 20:08, Ron Bickers wrote:
-----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.
This will probably be making it into a near future zope release - there have been some verbal commitments to making it happen on zope-coders... seb
participants (4)
-
Andreas Jung -
Derek Simkowiak -
Ron Bickers -
seb bacon