Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
dc4d7d1a
Commit
dc4d7d1a
authored
Jan 12, 2005
by
Tino Wildenhain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add virtual_hosting on application initialization - like in 2.7 head
parent
1297a56f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+19
-6
lib/python/OFS/tests/testAppInitializer.py
lib/python/OFS/tests/testAppInitializer.py
+11
-3
lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
...ython/Products/SiteAccess/tests/testVirtualHostMonster.py
+3
-2
No files found.
lib/python/OFS/Application.py
View file @
dc4d7d1a
...
...
@@ -291,7 +291,7 @@ class AppInitializer:
def
commit
(
self
,
note
):
get_transaction
().
note
(
note
)
get_transaction
().
commit
()
def
initialize
(
self
):
app
=
self
.
getApp
()
# make sure to preserve relative ordering of calls below.
...
...
@@ -303,8 +303,9 @@ class AppInitializer:
self
.
install_zglobals
()
self
.
install_inituser
()
self
.
install_errorlog
()
self
.
install_products
()
self
.
install_products
()
self
.
install_standards
()
self
.
install_virtual_hosting
()
self
.
check_zglobals
()
def
install_cp_and_products
(
self
):
...
...
@@ -316,7 +317,7 @@ class AppInitializer:
cpl
.
_init
()
app
.
_setObject
(
'Control_Panel'
,
cpl
)
self
.
commit
(
'Added Control_Panel'
)
# b/c: Ensure that a ProductFolder exists.
if
not
hasattr
(
aq_base
(
app
.
Control_Panel
),
'Products'
):
app
.
Control_Panel
.
Products
=
App
.
Product
.
ProductFolder
()
...
...
@@ -378,7 +379,7 @@ class AppInitializer:
default_limit
=
1000
default_period_secs
=
20
default_timeout_mins
=
20
limit
=
(
getattr
(
config
,
'maximum_number_of_session_objects'
,
None
)
or
default_limit
)
timeout_spec
=
getattr
(
config
,
'session_timeout_minutes'
,
...
...
@@ -452,7 +453,7 @@ class AppInitializer:
def
install_required_roles
(
self
):
app
=
self
.
getApp
()
# Ensure that Owner role exists.
if
hasattr
(
app
,
'__ac_roles__'
)
and
not
(
'Owner'
in
app
.
__ac_roles__
):
app
.
__ac_roles__
=
app
.
__ac_roles__
+
(
'Owner'
,)
...
...
@@ -498,6 +499,18 @@ class AppInitializer:
app
.
_setInitializerFlag
(
'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
):
if
not
doInstall
():
return
...
...
@@ -611,7 +624,7 @@ def get_products():
os
.
path
.
exists
(
os
.
path
.
join
(
fullpath
,
'__init__.pyo'
))
or
os
.
path
.
exists
(
os
.
path
.
join
(
fullpath
,
'__init__.pyc'
))
):
# import PluginIndexes 1st (why?)
priority
=
(
name
!=
'PluginIndexes'
)
priority
=
(
name
!=
'PluginIndexes'
)
# i is used as sort ordering in case a conflict exists
# between Product names. Products will be found as
# per the ordering of Products.__path__
...
...
lib/python/OFS/tests/testAppInitializer.py
View file @
dc4d7d1a
...
...
@@ -109,7 +109,7 @@ class TestInitialization( unittest.TestCase ):
self
.
assertEqual
(
app
.
temp_folder
.
session_data
.
meta_type
,
'Transient Object Container'
)
self
.
failUnless
(
app
.
_getInitializerFlag
(
'temp_folder'
))
def
test_install_tempfolder_and_sdc_status
(
self
):
self
.
configure
(
good_cfg
)
i
=
self
.
getOne
()
...
...
@@ -129,6 +129,14 @@ class TestInitialization( unittest.TestCase ):
self
.
assertEqual
(
app
.
browser_id_manager
.
meta_type
,
'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
):
self
.
configure
(
good_cfg
)
i
=
self
.
getOne
()
...
...
@@ -154,7 +162,7 @@ class TestInitialization( unittest.TestCase ):
root
=
i
.
getApp
().
_p_jar
.
root
()
self
.
failUnless
(
root
.
has_key
(
'ZGlobals'
))
self
.
failUnless
(
isinstance
(
root
[
'ZGlobals'
],
OOBTree
))
def
test_install_inituser
(
self
):
fname
=
os
.
path
.
join
(
TEMPNAME
,
'inituser'
)
f
=
open
(
fname
,
'w'
)
...
...
@@ -183,7 +191,7 @@ class TestInitialization( unittest.TestCase ):
i
=
self
.
getOne
()
i
.
install_products
()
self
.
failUnless
(
Application
.
misc_
.
__dict__
.
has_key
(
'OFSP'
))
def
test_install_standards
(
self
):
self
.
configure
(
good_cfg
)
i
=
self
.
getOne
()
...
...
lib/python/Products/SiteAccess/tests/testVirtualHostMonster.py
View file @
dc4d7d1a
"""Virtual Host Monster regression tests.
These tests mainly verify that OFS.Traversable.absolute_url()
These tests mainly verify that OFS.Traversable.absolute_url()
works correctly in a VHM environment.
Also see http://zope.org/Collectors/Zope/809
...
...
@@ -26,7 +26,8 @@ class VHMRegressions(unittest.TestCase):
transaction
.
begin
()
self
.
app
=
makerequest
(
Zope
.
app
())
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
.
folder
.
manage_addDTMLMethod
(
'doc'
,
''
)
self
.
app
.
REQUEST
.
set
(
'PARENTS'
,
[
self
.
app
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment