[Zope3-dev] getService() call local from global Bug/Hook
Jim Fulton
jim at zope.com
Fri May 28 05:26:17 EDT 2004
Roger Ineichen wrote:
> Hello
>
> I wrote a global and a local utility.
>
> For to lookup this utilities I use a adapter.
> In this adapter I use the principal annotation service.
>
> If I lookup the principal annotation service
> from the local utility I use:
>
> zapi.getService(self.context, PrincipalAnnotationServiceName)
>
> If I lookup the principal annotation service
> from the global utility I have to use:
>
> zapi.getService(None, PrincipalAnnotationServiceName)
>
> This ends in code like:
>
> try:
> aService = zapi.getService(self.context, PrincipalAnnotationServiceName)
> except:
> aService = zapi.getService(None, PrincipalAnnotationServiceName)
>
> Is there better way for to do that?
No, not any more.
Just use:
zapi.getService(PrincipalAnnotationServiceName)
We need to convery all of the existing calls to look like this
and add some deprecication warnings to let people know they should no
longer pass a context here.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list