[Zope-CMF] TypesTool ugly
alan runyan
runyaga@runyaga.com
Wed, 09 Apr 2003 21:12:55 -0500
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?)
The simplest thing possible is to add another check
on line line 174 in TypesTool.py
if not self.allowed_content_types: return 0
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.
thanks,
--
alan runyan
~runyaga@
Clearnoodle Studio
http://www.clearnoodle.com/