[Zope3-dev] Proposal: Vocabulary Fields

Martijn Faassen faassen@vet.uu.nl
Tue, 29 Apr 2003 19:11:14 +0200


Fred L. Drake, Jr. wrote:
> Martijn Faassen writes:
>  > Why such a restricted dynamism? Are we going to introduce a new set of
>  > classes if people want 'required' state to be dynamic?
> 
> These were intended as examples; I've tried to clarify that in the
> proposal.

But presumably your examples are only about allowed_values, and not about
other field properties, right?

>  > The approach I took in Formualtor is to allow (on any field) a way to call a 
>  > method to get the value of a field property, instead of getting it
>  > statically from the field itself. That way you allow the dynamism of
>  > *everything*, when the user so requires. Fields already have a way to get
>  > bound to objects which can be used this way (see the bind() method).
>  > The form code does this for you.
> ...
> [long example]
> ...
>  > This approach is simple to use, it allows other field properties to
>  > behave dynamically as well, and the interface actually states clearly
>  > that a field is going to be dynamic.
> 
> Neat, but scary.  There's a lot to swallow here.
> 
> One thing I like about the use of a registry is that the source of
> vocabularies can be specified in ZCML, so can be changed by the site
> developer; that's more painful if content objects need to know about
> vocabulary sources.

That's true. On the other hand, vocabularies generally do have something
to do with the content object or at least the context of the content
object. Perhaps you can come up with some examples on this how this
would work? For instance, one could have 'apparel' objects which have
a selection of 'colors' or 'sizes', but this can be different for each
particular instance.

>  > Worrisome in the proposal as well is the inclusion of presentation 
>  > information in the field. Now I understand this is only presentation of
> 
> There was definately some lack of clarity in the proposal; my
> preliminary implementation allowed the presentation to go unspecified,
> which caused a default presentation for the vocabulary to be retrieved
> from the presentation registry.
> 
> That's no longer an issue, since the presentation stuff has gone.

What would replace this facility? I did think it was interesting to
be able to define things like sort order and display name versus
internal name.

[snip]
>  > Two new registries (one for vocabularies and one for presentations) added
>  > to the system for this functionality also seems worrying.. This requires
>  > quite a few registrations of things before you can actually start to use
>  > a VocabularyField, which may be a usability issue.  
> 
> Perhaps.  I've modified the proposal to only include one (the
> vocabulary registry), which mitigates this issue somewhat.  The
> vocabulary registry is still used, and I'd expect the registry used in
> Zope to take advantage of ZCML and the component architecture.

Perhaps some concrete examples of use cases would help us out flesh
out the details.

Regards,

Martijn