[Zope-CMF] Uploading news items with FTP
Jeffrey P Shell
jeffrey@Digicool.com
Tue, 24 Apr 2001 11:13:19 -0400
On 4/24/01 10:49 AM, "Shane Hathaway" <shane@digicool.com> wrote:
> PortalFolder.PUT_factory will, in the (hopefully near) future, invoke the
> portal_types tool to decide what kind of upload it is. Really the only
> thing holding it up is a decision on the UI for configuring the upload
> behavior. Perhaps we should just make it a configurable script similar to
> this:
>
> if content_type=='text/plain':
> if string.lower(headers.get('Type', '')) == 'news':
> return 'News Item'
> elif content_type='text/html':
> return 'Document'
> return default_type(content_type)
>
> The script, a skinnable object and probably called 'getTypeForUpload',
> would be supplied the 'headers', 'content_type', and 'default_type'
> parameters and would be expected to return the ID of a type. The
> default_type function would look at the mime_type parameter (which doesn't
> exist yet) of each type and the first match it finds would win.
>
> What do you think? This solution would be easy and flexible.
I hope this would be very short lived. One of Zope's major problems is that
there are all sorts of cool little scripts with certain names and special
properties you can set that suddenly (and sometimes accidentally) enable
wondrous magical behavior. It's bad design, in my opinion, to rely too much
on them. Like the "Scriptable Type Information" (I don't even know how to
use those), something like this should only be used to augment behavior and
handle cases that can't be caught by the default framework and
configurations. I don't think it should be used in lieu of a real feature,
because it tends to cause development of that feature to slide further back
(or never occur).
In other words, I think that we should focus on doing this ONLY if we can
get the Types Tool to handle upload types as well.
Jeffrey P Shell, jeffrey@Digicool.com
http://www.digicool.com/ | http://www.zope.org