Re: TextField's handling of mimetypes is dumb
"Martin Aspeli" <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <op.s2ec06apfyd109@vigor54> |
On Mon, 26 Dec 2005 13:28:40 +0100, Sidnei da Silva <sidnei-/awGbKECNgO/3pe1ocb+swC/[email protected]> wrote: > On Mon, Dec 26, 2005 at 05:00:40AM +0100, Martin Aspeli wrote: > | Why can't it default to the default_content_type? This is a property on > | the field, not the widget, which implies it should apply at the field > | level, not just TTW. > > Because explicit is better than implicit? Would you like it if you > did setMyField(<content-of-a-word-file>) and it ended up with > 'text/x-web-intelligent'? You must think about the other use-cases > behind this, not just yours. Indeed. :) In this case, the only allowable_content_type is 'text/x-web-intelligent'. I'd prefer an exception if a word file was uploaded there. And frankly, when I explicitly set a default_content_type, that's more than explicit enough for me - it's a configuration of the field, so why should the mutator implicitly change the content type (to something I explicitly said was disallowed) by doing some guesswork on the string I set? The way it works now, allowable_content_types is simply a vocabulary for the widget, nothing more, as far as I can see. I'd say that the mimetype guessing should fall back on the default content type when it can't make a decision, and should only consider types in allowable_content_types when it has to guess the mimetype of a string. Martin -- (muted) ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click