Hi, On Wed, Jun 18, 2008 at 10:31:30PM +0200, Malthe Borch wrote:
Currently views are registered as components providing zope.interface.Interface; this is unfortunate since other kinds of components may use the same specification, namely (context, request).
An example of this is ``IAbsoluteURL``; it clashes with the resources view*.
In the words of Christian Theune: "I think it looks like one should never ask for adaptions to Interface."
In those cases the adapters are chosen solely on the specificity of the adaptation's requirement and it becomes easy to mix up semantics from unrelated code. I'd be interested in a use case where adapting to Interface is not just a (questionable) convenient short-cut but an actual semantically correct operation and could not be replaced with a more specific interface. Looking at zope.component.interfaces I find that there is an inconsistency in the APIs. The actual registry APIs all require an interface to be specified for an adaptation, but the module-global facade API provides zope.interface.Interface as the default. I take that as another indicator for an anti-pattern.
I suggest we then register views as components providing ``zope.component.IView``; browser views should provide ``zope.publisher.interfaces.browser.IBrowserView``.
I don't think zope.component wants to know about views. The interface should be in a package that already knows about views. Christian -- Christian Theune · ct@gocept.com gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1 Zope and Plone consulting and development