Jim Fulton wrote:
Martijn Faassen wrote:
Then this and the __component_adapts__ hack should be enough to make
it work (still an unpleasant hack, that).
Huh? Use adapter.
# initialize a new factory
Another one that I couldn't find but is indeed there, sorry. It's right
there in the zope.component README.txt with an example:
>>> def personJob(person):
... return getattr(person, 'job', None)
>>> personJob = interface.implementer(IJob)(personJob)
>>> personJob = component.adapter(IPerson)(personJob)
Okay, that's one step closer to support for this in the annotation
In the new world for ZCML, ZCML as a language falls apart in a
minimalistic XML language, and some support code (such as
zope.app.annotation.AnnotationFactory) to help it do more advanced things.
One remaining benefit of higher-level ZCML is that it gets picked up by
apidoc and thus can be discovered fairly easily by developers as part of
the configuration story. While AnnotationFactory is doing definition and
is in Python code in the new world for ZCML, this act of definition is
closely associated with the act of registering it in ZCML.
It would be nice if we somehow retained discoverability for APIs that
are meant to work with ZCML - it's obvious from this subthread that it
takes some idiots^H^H^H^H^H^Hpeople a while to pick up an API... We'd
like people working with annotations to be able to find out that we have
this available. Perhaps a README.txt in the annotation package is enough
for now, though. Perhaps we can think of other ways to help make this
Zope3-dev mailing list