[Zope3-dev] Re: for attribute not checked in zcml

2007-06-10 Thread Martin Aspeli

Christophe Combelles wrote:

Hello,

Many zcml directives have a for attribute, which take an interface as 
argument. Absent-minded people like me sometimes happen to put a real class 
instead of an interface in the for attributes.


* On browser:page, one can put a real class with no error. Is it correct?


Yes. Browser views are just adapters, and adapters can be registered for 
a specific class, as well as for an interface. Think of a class as being 
an interface which is implemented by a single class only (itself).



* On browser:containerViews, that lead to a non explicit error :
  Error object: list.index(x): x not in list


I'm not familiar with this directive, but it sounds like a bug, or if it 
really isn't supported here, then it should throw an error.



Is there a possibility to check this thing during startup, when zcml is parsed?
That would save time finding out what the real problem is.


It's a feature, not a bug. :)

Martin

--
Acquisition is a jealous mistress

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: for attribute not checked in zcml

2007-06-10 Thread Christophe Combelles

Martin Aspeli a écrit :

Christophe Combelles wrote:

Hello,

Many zcml directives have a for attribute, which take an interface 
as argument. Absent-minded people like me sometimes happen to put a 
real class instead of an interface in the for attributes.


* On browser:page, one can put a real class with no error. Is it correct?


Yes. Browser views are just adapters, and adapters can be registered for 
a specific class, as well as for an interface. Think of a class as being 
an interface which is implemented by a single class only (itself).



Does it mean I can have both a generic view for an interface, and a specific 
view for a particular implementation of that interface ?


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: for attribute not checked in zcml

2007-06-10 Thread Jim Fulton


On Jun 10, 2007, at 7:36 AM, Christophe Combelles wrote:


Martin Aspeli a écrit :

Christophe Combelles wrote:

Hello,

Many zcml directives have a for attribute, which take an  
interface as argument. Absent-minded people like me sometimes  
happen to put a real class instead of an interface in the for  
attributes.


* On browser:page, one can put a real class with no error. Is it  
correct?
Yes. Browser views are just adapters, and adapters can be  
registered for a specific class, as well as for an interface.  
Think of a class as being an interface which is implemented by a  
single class only (itself).



Does it mean I can have both a generic view for an interface, and a  
specific view for a particular implementation of that interface ?


Yes.

Jim

--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com