i trying understand annotations document:
http://docs.zope.org/zope.annotation/index.html
however example fails when run.
i get:
traceback (most recent call last): file "./zopepy", line 366, in <module> exec(compile(__file__f.read(), __file__, "exec")) file "test1.py", line 29, in <module> bar = ibar(foo) file "eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 156, in adapter_hook return sitemanager.queryadapter(object, interface, name, default) file "eggs/zope.component-3.9.5- py2.7.egg/zope/component/registry.py", line 228, in queryadapter return self.adapters.queryadapter(object, interface, name, default) file "eggs/zope.annotation-3.5.0-py2.7.egg/zope/annotation/factory.py", line 42, in getannotation annotations = zope.annotation.interfaces.iannotations(context) typeerror: ('could not adapt', <__main__.foo object @ 0xb6d6956c>, <interfaceclass zope.annotation.interfaces.iannotations>)
example missing following statements:
from zope.annotation.attribute import attributeannotations provideadapter(attributeannotations)
Comments
Post a Comment