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

Rocky Burt rocky at serverzen.com
Thu Nov 9 07:14:48 EST 2006


On Thu, 2006-09-11 at 11:13 +0000, 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.

I do this frequently when I want to adapt classes I have no control over
(such as in Products.CMFPlone, etc).

Personally I'm a little pragmatic ... 
  1) I tend to adapt the classes first
  2) as more flexibility is required, I introduce a new marker interface
and apply it to the previous class
  3) then change the ZCML/adapter mapping to apply to the marker
interface

Since the consumers of the adapters never need to be changed no matter
how the adapters are rigged up, I'm safe.

- Rocky

-- 
Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20061109/9e3700b0/attachment.bin


More information about the Zope3-dev mailing list