[Zope-dev] Make simple ISource usable

Roger Ineichen dev at projekt01.ch
Fri Aug 29 09:01:52 EDT 2008


I'll try to make the ISource API smooth and usable
for other components. Right now ISource provides no 
simple API for work with terms.

Since a ISource only provides a __contains__ method
and the IterableSource the __iter__ method,
there is some more needed which makes it easy to
work with terms next to the ISourceQueriables API.

The zope.app.form.browser.interfaces.ITerms
defines one possible way to make it work
like a vocabulary because it defines the methods
getTerm(value) and getValue(token).

The z3c.form.interfaces.ITerms defines also
such a query API but right now only or vocabularies.

I propose to define such a ITerms interface in 
zope.schema.interfaces which makes it possible
to implement simple ISource terms and work with
the ITerm values like we do in vocabularies.

This whould not affect other implementations like
the ISourceQueriables etc. It only offers the 
a way to implement reusable simple ISource components
without the need that every UI framework needs to
implement their own interfaces for query ISource 
component in their own way (e.g. ITerms).

The current state of ISource/ITerms concept whould not 
work if someone will switch form zope.app.form based 
sources to z3c.form based sources because of it's 
different ITerms implementations.

Or if someone defines a zope.schema.ISource in a 3rd party 
package, the zope.app.form.browser.interfaces.ITerms is 
often used for query ITerms even if it's only used in python 
code without any form framework. That's a real bad dependency.

Fazit,
The only query API defined for ISource in zope.schema
is the ISourceQueriables API. That's defently to less
and makes it required to implement custom query APIs
in UI frameworks if we need to work with terms.

I no one objects, I'll start a zope.schema branch and 
let you know about the progress and a hopfully a simple
solution. Additional to them I started allready a 
z3c.form branch for adjust the ITerms implementation.
As far as I can see right now this refactoring will only 
provides additional features.

What do you think? Any objections or hints about that?

Regards
Roger Ineichen
_____________________________
Projekt01 GmbH
www.projekt01.ch
Boesch 65
6331 Hünenberg
phone     +41 (0)41 781 01 78
mobile    +41 (0)79 340 52 32
fax       +41 (0)41 781 00 78
email roger.ineichen at projekt01.ch
_____________________________
END OF MESSAGE



More information about the Zope-Dev mailing list