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
a4da9259
Commit
a4da9259
authored
May 20, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge further janitorial changes from 2.12 branch.
parent
e1a6d7d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
src/Products/SiteAccess/VirtualHostMonster.py
src/Products/SiteAccess/VirtualHostMonster.py
+10
-6
src/Products/SiteAccess/tests/testVirtualHostMonster.py
src/Products/SiteAccess/tests/testVirtualHostMonster.py
+27
-2
No files found.
src/Products/SiteAccess/VirtualHostMonster.py
View file @
a4da9259
...
...
@@ -58,8 +58,9 @@ class VirtualHostMonster(Persistent, Item, Implicit):
try
:
host
,
path
=
[
x
.
strip
()
for
x
in
line
.
split
(
'/'
,
1
)]
except
:
raise
ValueError
,
(
'Line needs a slash between host and path: %s'
%
line
)
raise
ValueError
(
'Line needs a slash between host and path: %s'
%
line
)
pp
=
filter
(
None
,
path
.
split
(
'/'
))
if
pp
:
obpath
=
pp
[:]
...
...
@@ -105,7 +106,8 @@ class VirtualHostMonster(Persistent, Item, Implicit):
self
.
lines
=
tuple
(
new_lines
)
self
.
have_map
=
not
not
(
fixed_map
or
sub_map
)
# booleanize
if
RESPONSE
is
not
None
:
RESPONSE
.
redirect
(
'manage_edit?manage_tabs_message=Changes%20Saved.'
)
RESPONSE
.
redirect
(
'manage_edit?manage_tabs_message=Changes%20Saved.'
)
def
addToContainer
(
self
,
container
):
container
.
_setObject
(
self
.
id
,
self
)
...
...
@@ -195,15 +197,17 @@ class VirtualHostMonster(Persistent, Item, Implicit):
vh_part
=
path
.
pop
(
0
)[
1
:]
if
vh_part
:
request
[
'VIRTUAL_URL_PARTS'
]
=
vup
=
(
request
[
'SERVER_URL'
],
vh_part
,
quote
(
'/'
.
join
(
path
)))
request
[
'SERVER_URL'
],
vh_part
,
quote
(
'/'
.
join
(
path
)))
else
:
request
[
'VIRTUAL_URL_PARTS'
]
=
vup
=
(
request
[
'SERVER_URL'
],
quote
(
'/'
.
join
(
path
)))
request
[
'VIRTUAL_URL'
]
=
'/'
.
join
(
vup
)
# new ACTUAL_URL
add
=
(
path
and
request
[
'ACTUAL_URL'
].
endswith
(
'/'
))
and
'/'
or
''
request
[
'ACTUAL_URL'
]
=
request
[
'VIRTUAL_URL'
]
+
add
add
=
(
path
and
request
[
'ACTUAL_URL'
].
endswith
(
'/'
))
and
'/'
or
''
request
[
'ACTUAL_URL'
]
=
request
[
'VIRTUAL_URL'
]
+
add
return
vh_used
=
1
# Only retry once.
...
...
src/Products/SiteAccess/tests/testVirtualHostMonster.py
View file @
a4da9259
...
...
@@ -51,24 +51,49 @@ class VHMRegressions(unittest.TestCase):
m
=
self
.
app
.
folder
.
doc
.
getPhysicalPath
self
.
assertEqual
(
m
(),
(
''
,
'folder'
,
'doc'
))
def
test_actual_url
(
self
):
self
.
app
.
folder
.
manage_addDTMLMethod
(
'index_html'
,
''
)
def
test_actual_url_no_VHR_no_doc_w_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/folder/'
)
def
test_actual_url_no_VHR_no_doc_no_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/folder'
)
def
test_actual_url_no_VHR_w_doc_w_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/doc/'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/folder/doc/'
)
def
test_actual_url_no_VHR_w_doc_no_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/doc'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/folder/doc'
)
def
test_actual_url_w_VHR_w_doc_w_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/VirtualHostRoot/doc/'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/doc/'
)
def
test_actual_url_w_VHR_w_doc_no_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/VirtualHostRoot/doc'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/doc'
)
def
test_actual_url_w_VHR_no_doc_w_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/VirtualHostRoot/'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
'http://www.mysite.com/'
)
def
test_actual_url_w_VHR_w_doc_no_trailing_slash
(
self
):
ob
=
self
.
traverse
(
'/VirtualHostBase/http/www.mysite.com:80'
'/folder/VirtualHostRoot'
)
self
.
assertEqual
(
self
.
app
.
REQUEST
[
'ACTUAL_URL'
],
...
...
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