[Zope3-dev] ChoiceField and the use of sources/vocabularies

Christian Theune ct at gocept.com
Thu Sep 27 08:36:01 EDT 2007


Hi,

Zagy and I are trying to make z3c.form compatible with sources. We had
to investigate zope.schema for that and found the mess of vocabularies
and sources that is still around. 

Here are some facts we found:

- The Choice field has an attribute `vocabulary` which it says to be an
  'IBaseVocabulary' object.

- Reading the code of the choice field turns out that the actual
  contract is an 'ISource'.

- Most client code working against the `vocabulary` attribute actually
  assumes it to be an IIterableVocabulary.

- The vocabulary code is badly entangled and mixes up concepts that
  sources get right.

- Widgets for the choice field have to react differently to sources and
  vocabularies.

We think:

- The contract for the `vocabulary` attribute should be ISource.

- Client code (e.g. a widget) should adapt the generic source it gets to
  a more specific and richer interface like IIterableSource.

- Widgets for the choice field shouldn't have to care for two different
  things that the source could be.

- Vocabularies ought to die. 

Conclusion:

We'd love to remove all traces of vocabularies from zope.schema and it
more clear how to use sources.

As deprecation has fallen out of favor, we wonder how to get rid of
vocabularies. We definitely do not want to fork zope.schema. Would a
sufficiently newer version (3.5, 4?) rectify breaking something in this
way?

I estimate that providing BBB is going to be a real pain. :/

Christian

-- 
gocept gmbh & co. kg - forsterstrasse 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20070927/175cff26/attachment.bin


More information about the Zope3-dev mailing list