Commit dc4d7d1a authored by Tino Wildenhain's avatar Tino Wildenhain

add virtual_hosting on application initialization - like in 2.7 head

parent 1297a56f
...@@ -305,6 +305,7 @@ class AppInitializer: ...@@ -305,6 +305,7 @@ class AppInitializer:
self.install_errorlog() self.install_errorlog()
self.install_products() self.install_products()
self.install_standards() self.install_standards()
self.install_virtual_hosting()
self.check_zglobals() self.check_zglobals()
def install_cp_and_products(self): def install_cp_and_products(self):
...@@ -498,6 +499,18 @@ class AppInitializer: ...@@ -498,6 +499,18 @@ class AppInitializer:
app._setInitializerFlag('error_log') app._setInitializerFlag('error_log')
self.commit('Added site error_log at /error_log') self.commit('Added site error_log at /error_log')
def install_virtual_hosting(self):
app = self.getApp()
if app._getInitializerFlag('virtual_hosting'):
return
if not app.objectIds('Virtual Host Monster') and not hasattr(app, 'virtual_hosting'):
from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster
vhm=VirtualHostMonster()
vhm.id='virtual_hosting'
vhm.addToContainer(app)
app._setInitializerFlag('virtual_hosting')
self.commit('Added virtual_hosting')
def check_zglobals(self): def check_zglobals(self):
if not doInstall(): if not doInstall():
return return
......
...@@ -129,6 +129,14 @@ class TestInitialization( unittest.TestCase ): ...@@ -129,6 +129,14 @@ class TestInitialization( unittest.TestCase ):
self.assertEqual(app.browser_id_manager.meta_type,'Browser Id Manager') self.assertEqual(app.browser_id_manager.meta_type,'Browser Id Manager')
self.failUnless(app._getInitializerFlag('browser_id_manager')) self.failUnless(app._getInitializerFlag('browser_id_manager'))
def test_install_virtual_hosting(self):
self.configure(good_cfg)
i = self.getOne()
app = i.getApp()
i.install_virtual_hosting()
self.assertEqual(app.virtual_hosting.meta_type,'Virtual Host Monster')
self.failUnless(app._getInitializerFlag('virtual_hosting'))
def test_install_session_data_manager(self): def test_install_session_data_manager(self):
self.configure(good_cfg) self.configure(good_cfg)
i = self.getOne() i = self.getOne()
......
...@@ -26,7 +26,8 @@ class VHMRegressions(unittest.TestCase): ...@@ -26,7 +26,8 @@ class VHMRegressions(unittest.TestCase):
transaction.begin() transaction.begin()
self.app = makerequest(Zope.app()) self.app = makerequest(Zope.app())
try: try:
self.app.manage_addProduct['SiteAccess'].manage_addVirtualHostMonster('VHM') #self.app.manage_addProduct['SiteAccess'].manage_addVirtualHostMonster('VHM')
# now we have a VHM as virtual_hosting per default
self.app.manage_addFolder('folder') self.app.manage_addFolder('folder')
self.app.folder.manage_addDTMLMethod('doc', '') self.app.folder.manage_addDTMLMethod('doc', '')
self.app.REQUEST.set('PARENTS', [self.app]) self.app.REQUEST.set('PARENTS', [self.app])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment