[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/appsetup/ Ported fix
for Bug 486 to trunk.
Christian Theune
ct at gocept.com
Thu Dec 15 08:38:11 EST 2005
Log message for revision 40789:
Ported fix for Bug 486 to trunk.
Changed:
U Zope3/trunk/src/zope/app/appsetup/bootstrap.py
U Zope3/trunk/src/zope/app/appsetup/tests.py
-=-
Modified: Zope3/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py 2005-12-15 11:04:26 UTC (rev 40788)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py 2005-12-15 13:38:11 UTC (rev 40789)
@@ -101,8 +101,7 @@
reg.status = initial_status
def getSiteManagerDefault(root_folder):
- package_name = '/++etc++site/default'
- package = traverse(root_folder, package_name)
+ package = traverse(root_folder.getSiteManager(), 'default')
return package
def getInformationFromEvent(event):
Modified: Zope3/trunk/src/zope/app/appsetup/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/tests.py 2005-12-15 11:04:26 UTC (rev 40788)
+++ Zope3/trunk/src/zope/app/appsetup/tests.py 2005-12-15 13:38:11 UTC (rev 40789)
@@ -21,10 +21,12 @@
from ZODB.tests.util import DB
+from zope.app import zapi
+from zope.app.component import hooks
from zope.app.component.testing import PlacefulSetup
from zope.app.error.error import ErrorReportingUtility
from zope.app.error.interfaces import IErrorReportingUtility
-from zope.app.folder import rootFolder
+from zope.app.folder import rootFolder, Folder
from zope.app.folder.interfaces import IRootFolder
from zope.app.publication.zopepublication import ZopePublication
from zope.app.component.site import LocalSiteManager
@@ -70,6 +72,12 @@
root[ZopePublication.root_name] = self.root_folder
self.site_manager = LocalSiteManager(self.root_folder)
self.root_folder.setSiteManager(self.site_manager)
+
+ sub_folder = Folder()
+ self.root_folder["sub_folder"] = sub_folder
+ sub_site_manager = LocalSiteManager(sub_folder)
+ sub_folder.setSiteManager(sub_site_manager)
+
transaction.commit()
cx.close()
@@ -85,10 +93,27 @@
package = traverse(root_folder, package_name)
cx.close()
+ def test_ensureUtilityForSubSite(self):
+ self.createRFAndSM()
+
+ db, connection, root, root_folder = getInformationFromEvent(
+ EventStub(self.db))
+
+ sub_folder = root_folder['sub_folder']
+ ensureUtility(sub_folder, IErrorReportingUtility,
+ 'ErrorReporting', ErrorReportingUtility,
+ 'ErrorReporting')
+
+ # Make sure it was created on the sub folder, not the root folder
+ got_utility = zapi.getUtility(IErrorReportingUtility, name='ErrorReporting',
+ context=sub_folder)
+ got_path = zapi.getPath(got_utility)
+ self.assertEquals("/sub_folder/++etc++site/default/ErrorReporting", got_path)
+
def test_ensureUtility(self):
self.createRFAndSM()
- db, connection ,root, root_folder = getInformationFromEvent(
+ db, connection, root, root_folder = getInformationFromEvent(
EventStub(self.db))
# TODO: check EventSub
More information about the Zope3-Checkins
mailing list