[Zope3-dev] Schema fields, widgets, allowable_values and items

Jim Fulton jim@zope.com
Mon, 04 Nov 2002 10:20:01 -0500


Martijn Faassen wrote:
> Jim Fulton wrote:
> [snip]
> 
>>I have a couple of options.  I could changes the widgets to use 
>>allowed_values,
>>but then they won't have separate labels. This will only affect the 
>>cache-selection
>>views for cachable objects at this point.

Actually, it won't affect cacheable objects, since these son't
really use cache labels.


 > These use a custom widget that
>>could
>>get the labels it wants from the cache service.
>>
>>I think I'll go ahead and change the widgets to use allowed_values for now.
>>
>>Alternatively, we could extend allowed_values or add another field 
>>attribute to
>>store labels^H^H^H^H^H^Htitles.
>>
> 
> I think there are two cases. One is where the titles/labels are part of
> the field metadata.  Another is where the allowed_values and their
> titles (and even descriptions, etc) come from some content source.

I'm not asking about *where* the data comes from. I'm asking whether
labels/titles, whether static or dynamic, should be part of a field definition
at all.


 > I imagine
> you could solve the latter by using a custom widget responsible for
> displaying the labels, though in some cases there may be some trouble
> hooking up the labels to the values. Conceivably a third case is that
> this is a responsibility solely of the widget, though ordinary 
> field titles aren't and these titles would seem to describe the content
> just as much as they do.

Right.


> I don't understand what you mean by it only affecting the cache selection
> views for cachable objects at this point. Is this it the only code
> that uses selection lists right now?

It's the only code that suggests that it expects labels for selected
values, but it doesn't even do that. Unfortunately, the related widget
code has numerous bits of dwim that make this all extra hard to sort out.

So, are you saying that we should amend allowed_values to be not just
a sequence of values but a sequence of values and labels? Or should there
be a separate property?

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org