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 __init__(self, context):
...     pass
...
>>> zope.component.provideAdapter(BToSomething, 
[zope.interface.implementedBy(B)], ISomething)
>>> ISomething(b)
<__main__.BToSomething object at 0xb7a4fa4c>
>>> from zope.component.globalregistry import base
>>> base.__init__('base')
>>> ISomething(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: ('Could not adapt', <__main__.B object at 0xb7a4f96c>, 
<InterfaceClass __main__.ISomething>)
>>> zope.component.provideAdapter(BToSomething, 
[zope.interface.implementedBy(A)], ISomething)
>>> ISomething(b)
<__main__.BToSomething object at 0xb7a4f9ac>
>>>   

-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to