[Zope3-dev] Re: zope.sendmail having dependency
ccomb at free.fr
Fri Aug 31 08:04:01 EDT 2007
Christian Theune a écrit :
> Am Freitag, den 31.08.2007, 13:06 +0200 schrieb Wichert Akkerman:
>> Is there documentation on sources anywhere? The last time I checked
>> there was nothing that I could understand either in zope.* or
>> on the wiki.
> It took me a while to understand them myself. Especially as there is
> some code in there that is basically not useful.
> I'll try to give a very short overview:
> Sources are designed with three concepts:
> - The source itself - an iterable
> This can return any kind of object it wants. It doesn't have to care
> for browser representation, encoding, ...
> - A way to map a value from the iterable to something that can be used
> for form *values* - this is called a token
> - A way to map a value to something that can be displayed to the user -
> this is called a title
> The last two elements are dispatched using a so called `term`. The
> ITitleTokenizedTerm interface contains a triple of (value, token, term).
> Additionally there are some lookup functions to perform the mapping
> between values and terms and tokens and terms.
> Sources that require context use a special factory: a context source
> binder that is called with the context and instanciates the source when
> it is actually used.
> The general design is very nice as it seperates the concerns correctly,
> for simple use cases it requires you to write quite a few components (3
> classes most times) which is why I came up with zc.sourcefactory which
> basically provides a cleaner easy-to-use API for (as the name says)
> application developers while having the backend APIs be logically sound.
> Hope this helped,
I was still using vocabularies, but it seems interesting, thanks for the
So it basically looks like a vocabulary, with the token and title parts being
seperated and optional.
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/ccomb%40free.fr
More information about the Zope3-dev