[CMF-checkins] SVN: CMF/trunk/CMF - added fallback for missing
ISiteRoot registration (allows to access at least the ZMI)
Yvo Schubbe
y.2007- at wcm-solutions.de
Wed Mar 7 18:52:59 EST 2007
Log message for revision 73043:
- added fallback for missing ISiteRoot registration (allows to access at least the ZMI)
Changed:
U CMF/trunk/CMFCore/URLTool.py
U CMF/trunk/CMFDefault/PropertiesTool.py
-=-
Modified: CMF/trunk/CMFCore/URLTool.py
===================================================================
--- CMF/trunk/CMFCore/URLTool.py 2007-03-07 23:40:36 UTC (rev 73042)
+++ CMF/trunk/CMFCore/URLTool.py 2007-03-07 23:52:58 UTC (rev 73043)
@@ -22,7 +22,7 @@
from Globals import InitializeClass
from OFS.SimpleItem import SimpleItem
-from zope.component import getUtility
+from zope.component import queryUtility
from zope.interface import implements
from ActionProviderBase import ActionProviderBase
@@ -77,7 +77,11 @@
def getPortalObject(self):
""" Get the portal object itself.
"""
- return getUtility(ISiteRoot)
+ site = queryUtility(ISiteRoot, None)
+ if site is None:
+ # fallback
+ return aq_parent(aq_inner(self))
+ return site
security.declarePublic('getRelativeContentPath')
def getRelativeContentPath(self, content):
Modified: CMF/trunk/CMFDefault/PropertiesTool.py
===================================================================
--- CMF/trunk/CMFDefault/PropertiesTool.py 2007-03-07 23:40:36 UTC (rev 73042)
+++ CMF/trunk/CMFDefault/PropertiesTool.py 2007-03-07 23:52:58 UTC (rev 73043)
@@ -20,8 +20,8 @@
from Globals import InitializeClass, DTMLFile
from OFS.SimpleItem import SimpleItem
from Products.MailHost.interfaces import IMailHost
-from zope.app.component.hooks import getSite
from zope.component import getUtility
+from zope.component import queryUtility
from zope.interface import implements
from Products.CMFCore.ActionProviderBase import ActionProviderBase
@@ -73,7 +73,11 @@
ps.props.manage_changeProperties(props)
def title(self):
- return getUtility(ISiteRoot).title
+ site = queryUtility(ISiteRoot)
+ if site is None:
+ # fallback
+ return aq_parent(aq_inner(self)).title
+ return site.title
def smtp_server(self):
return getUtility(IMailHost).smtp_host
More information about the CMF-checkins
mailing list