[Grok-dev] MultiAdapter doc bug?

Graham Stratton gns24 at mythic-beasts.com
Mon Jun 23 23:22:19 EDT 2008


The documentation in http://svn.zope.org/grok/tags/0.13/doc/reference/components.rst 
  implies that you can get a multiadapter like this:

 >>> home = IHome(cave, fireplace)

I'm pretty sure this doesn't work. It certainly isn't how we do the  
lookup in our tests:

 >>> home = zope.component.getMultiAdapter((cave, fireplace))

I think that if you want to specify the interface you're adapting to  
you can do:

 >>> home = zope.component.getMultiAdapter((cave, fireplace), IHome)

To be honest I don't understand why you wouldn't want to specify the  
interface you're adapting to.

Assuming this is a bug I'll fix it if someone suggests which of the  
above options is the preferred approach.

Thanks,

Graham


More information about the Grok-dev mailing list