[Zope-dev] Question: additional context for IAnnotations adapter?

Chris Withers chris at simplistix.co.uk
Fri Mar 13 05:38:43 EDT 2009


Dan Korostelev wrote:
> 2009/3/9 Dieter Maurer <dieter at handshake.de>:
>> Jacob Holm wrote at 2009-3-6 01:55 +0100:
>>> ...
>>> I added it while working for ZC two years ago. It was needed to support
>>> a use case where the context used for looking up the annotation was not
>>> necessarily the current site. I don't know if the use case is still
>>> relevant to ZC, but the pattern is still being used in e.g.
>>> zc.notification and zope.app.preference (where it was added by me at the
>>> time).
>> I expect that use cases like this (looking up objects in a foreign site
>> context) will be important for my current employer (if it continuous to
>> use Zope in the future).
> 
> Thanks for comments. The functionality stayed and migrated to
> zope.principalannotation. It now even have a doctest. :-)

It's interesting, this use case sound pretty close to what I'm talking 
about in the very last part of this message:

http://mail.zope.org/pipermail/zope-dev/2009-March/035220.html

ie: adapter context based on object traversal rather than notion of 
"current site".

Can someone confirm to me whether or not manually specifying the context 
as I have in the example above would work, or would I need to do:

 >>> adapter1 = getAdapter(a,ISomething,context=siteA)
 >>> adapter2 = getAdapter(b,ISomething,context=siteB)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list