[Zope-CMF] TypesTool ugly

Florent Guillaume fg@nuxeo.com
Thu, 10 Apr 2003 17:04:42 +0200


In article <oprnd5rtjovtwssu@smtp-server.houston.rr.com> you write:
> How do you make a folder that has nothing addable to it?
> TypesTool.TypeInformation.allowType() does not handle this condition.
> 
> How to reproduce:
> 
>  - portal_types -> Select Folder
> 
>  - check Filter content types
> 
>  - unselect all Allowed content types
> 
>  - save
> 
> goto a Folder and click New button you get TypeError,
> 'in ' requires character as left operand
> 
> In Plone its worse because we build up a select list
> of available types to add in folder_contents.  So it throws
> the exception and you can not see folder_contents.
> 
> This is because self.allowed_content_types turns into a string when nothing 
> is selected.  NOTE: This to me seems
> like unexpected behavior because the form marshalling code
> says allowed_content_types:utf8:list (shouldnt this marshall empty strings 
> into empty list?)

So this looks like a bug in Zope core...
What Zope version is this?

> The simplest thing possible is to add another check
> on line line 174 in TypesTool.py
> 
> if not self.allowed_content_types: return 0

If the bug is in Zope core we'd still have to put this fix in CMF for
backward compat, yes.

> anyone have an objection to this going in?  or am I looking
> in the wrong place for the fix?  I can even modify the CMF
> folder_contents template so the New button doesnt show up -
> if desired.

Why not.. folder_contents is already such a heap of miscellanea that
adding a bit more won't matter I think.

Florent


-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com