[Zope3-dev] adaptation based on class rather than interface
Chris Withers
chris at simplistix.co.uk
Thu Nov 9 06:13:01 EST 2006
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"
provides=".interfaces.ISomething"
factory=".adapters.MyAdapter"
/>
..in addition to the normal registration for interfaces.
- be able to adapt objects based on their class if no interfaces match:
class MyClass: pass
obj = MyClass()
ISomething(obj)
I'm expecting people to say "NO!" very loudly, but I'm interested in the
real reasons for why this is bad.
Having to define interfaces purely so an adapter can be registered seems
tortological to me...
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope3-dev
mailing list