Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-14 Thread Martijn Faassen
Martin Aspeli wrote: Martijn Faassen wrote: Oh, I disagree. It's much nicer to be able to be able to start with adapting classes, and introduce interfaces later, where necessary. Often they're not. In fact it's already possible to adapt classes and register views for classes. In ZCML I

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-14 Thread Jim Fulton
Martijn Faassen wrote: Martin Aspeli wrote: Martijn Faassen wrote: Oh, I disagree. It's much nicer to be able to be able to start with adapting classes, and introduce interfaces later, where necessary. Often they're not. In fact it's already possible to adapt classes and register views for

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-13 Thread Lennart Regebro
On 11/9/06, Jean-Marc Orliaguet [EMAIL PROTECTED] wrote: Lennart Regebro wrote: On 11/9/06, Chris Withers [EMAIL PROTECTED] wrote: Why do you say extra ZCML registration? You need that ZCML registration whether or not you have to write the marker interface... Sure, but with the marker

[Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Chris Withers
Hi All, I find myself often having to define pure marker interfaces for each class that I define, purely so I can register adapters for objects of that class. How do people feel about: - being able to register an adapter as follows: adapter for=.myclasses.MyClass

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Lennart Regebro
On 11/9/06, Chris Withers [EMAIL PROTECTED] wrote: I'm expecting people to say NO! very loudly, but I'm interested in the real reasons for why this is bad. Well it removes the possibility of switching out the class, which begs the question why you would have an adapter in the first place.

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Lennart Regebro
On 11/9/06, Chris Withers [EMAIL PROTECTED] wrote: It's not one to one: adapter for=.myclasses.MyClassA provides=.interfaces.ISomething factory=.adapters.MyAdapter1 / adapter for=.myclasses.MyClassB provides=.interfaces.ISomething factory=.adapters.MyAdapter1

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Lennart Regebro
Sorry about the premature sending, I don't know what button I pressed... Here we go again: So instead of making a marker interface, which is two lines of code, and two registrations, a total of six lines (with the imports), you have an extra ZCML registration statement, which is three lines of

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Lennart Regebro
On 11/9/06, Chris Withers [EMAIL PROTECTED] wrote: Why do you say extra ZCML registration? You need that ZCML registration whether or not you have to write the marker interface... Sure, but with the marker interface you need only one. You need one for each class, in your example, thats two. So

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Jim Fulton
Chris Withers wrote: Hi All, I find myself often having to define pure marker interfaces for each class that I define, purely so I can register adapters for objects of that class. How do people feel about: - being able to register an adapter as follows: adapter for=.myclasses.MyClass

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Chris Withers
Jim Fulton wrote: adapter for=.myclasses.MyClass provides=.interfaces.ISomething factory=.adapters.MyAdapter / I think it is a fine idea. That's why it has been supported for a long time. You can register adapters and views (which, of course are adapters) for classes as well

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Martijn Faassen
Martin Aspeli wrote: Chris Withers wrote: I find myself often having to define pure marker interfaces for each class that I define, purely so I can register adapters for objects of that class. Why does your class not have a (non-marker) interface in the first place? The use of interfaces as

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Martijn Faassen
Chris Withers wrote: Jim Fulton wrote: adapter for=.myclasses.MyClass provides=.interfaces.ISomething factory=.adapters.MyAdapter / I think it is a fine idea. That's why it has been supported for a long time. You can register adapters and views (which, of course are

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Shane Hathaway
Chris Withers wrote: Jim Fulton wrote: adapter for=.myclasses.MyClass provides=.interfaces.ISomething factory=.adapters.MyAdapter / I think it is a fine idea. That's why it has been supported for a long time. You can register adapters and views (which, of course are

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Stephan Richter
On Thursday 09 November 2006 10:02, Chris Withers wrote: ...will work, right? import zope.component class A(object): ... pass ... class B(A): ... pass ... import zope.interface class ISomething(zope.interface.Interface): ... pass ... class BToSomething(object): ... def

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Jean-Marc Orliaguet
Lennart Regebro wrote: On 11/9/06, Chris Withers [EMAIL PROTECTED] wrote: Why do you say extra ZCML registration? You need that ZCML registration whether or not you have to write the marker interface... Sure, but with the marker interface you need only one. You need one for each class, in

Re: [Zope3-dev] adaptation based on class rather than interface

2006-11-09 Thread Dieter Maurer
Martin Aspeli wrote at 2006-11-9 04:37 -0800: ... Why does your class not have a (non-marker) interface in the first place? The use of interfaces as documentation and as formalisms for expressing a class' functionality (in adapters, utilities etc) is one of the benefits that Zope 3 introduces. I