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

Zope-CMF maillist  -

See for bug reports and feature requests

Reply via email to