Hi there,<br><br>I have a couple of interfaces sharing a common base that my annotation adapters will implement:<br><br>>>> from zope.interface import Interface<br>>>> class IBaseAnnotation(Interface):<br>
... pass<br>...<br>>>> class IAnnotationA(IBaseAnnotation):<br>... pass<br>... <br>>>> class IAnnotationB(IBaseAnnotation):<br>... pass<br>... <br><br>Along with a content class:<br><br>>>> class Content(object):<br>
... pass<br>... <br><br>And finally some actual adapters:<br><br>>>> import grok<br>>>> class AnnotationA(grok.Annotation):<br>... grok.implements(IAnnotationA)<br>... grok.context(Content)<br>
... <br>>>> class AnnotationB(grok.Annotation):<br>... grok.implements(IAnnotationB)<br>... grok.context(Content)<br>... <br><br>Imagine that the above has been grokked. <br><br>Let's get a Content object:<br>
<br>>>> content = Content()<br><br>And give it one annotation from the two adapters I've defined:<br><br>>>> meta_a = IAnnotationA(content)<br>>>> meta_a.foo = "MEGROK!!!"<br><br>Something strange now happens when I try to get all adapters to my base annotation interface from the component architecture:<br>
<br>>>> from zope.component import getAdapters<br>>>> list(getAdapters((content,), IBaseAnnotation)<br> [(u'', <....AnnotationB object at 0x8ff5f6c>)]<br><br>It's given me the wrong object back! If I rerun the above but _omit_ the definition of ``AnnotationB`` then it gives me the correct result of ``AnnotationA``. <br>
<br>After some digging, I found that using:<br><br>>>> from zope.annotations.interfaces import IAnnotations<br>>>> list(getAdapters((content,), IAnnotations)<br><br>gives correct results in both cases - but for my particular example it also gives a:<br>
``zope.dublincore.annotatableadapter.ZDCAnnotationData`` too (for container items only) which I don't want. I could filter this out of course without much problem - but something doesn't smell right!! <br><br>Any hints/advice would be welcomed!<br>
<br>Regards,<br>Paul<br>