[Zope-CMF] Re: getUtility(ISiteRoot) bug?
yuppie
y.2007- at wcm-solutions.de
Thu Mar 8 13:04:52 EST 2007
Philipp von Weitershausen wrote:
> yuppie wrote:
>> portal = getUtility(ISiteRoot)
>>
>>
>> I can't get this working. The lookup from within getExprContext fails.
>> But:
>>
>> - sm.registeredUtilities() contains the ISiteRoot registration
>
> Is 'sm' actually the current site manager? Try to compare whether
> z.c.getSiteManager() matches 'sm'.
They are the same:
(Pdb) [i for i in sm.registeredUtilities()]
[ ...,
UtilityRegistration(<PersistentComponents /mySite>, IURLTool, u'',
portal_url, u''),
...,
UtilityRegistration(<PersistentComponents /mySite>, ISiteRoot, u'',
mySite, u''),
...]
(Pdb) sm.getUtility(ISiteRoot)
*** ComponentLookupError: (<InterfaceClass
Products.CMFCore.interfaces._content.ISiteRoot>, u'')
(Pdb) sm.getUtility(IURLTool)
<URLTool at /mySite/portal_url>
Cheers, Yuppie
More information about the Zope-CMF
mailing list