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
d7dedb9b
Commit
d7dedb9b
authored
Feb 09, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge changes from 2.3 branch
parent
9b64c9e8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
32 deletions
+55
-32
lib/python/Products/SiteAccess/AccessRule.py
lib/python/Products/SiteAccess/AccessRule.py
+3
-3
lib/python/Products/SiteAccess/SiteRoot.py
lib/python/Products/SiteAccess/SiteRoot.py
+1
-1
lib/python/Products/SiteAccess/VirtualHostMonster.py
lib/python/Products/SiteAccess/VirtualHostMonster.py
+27
-8
lib/python/Products/SiteAccess/www/SiteRootAdd.dtml
lib/python/Products/SiteAccess/www/SiteRootAdd.dtml
+1
-3
lib/python/Products/SiteAccess/www/SiteRootEdit.dtml
lib/python/Products/SiteAccess/www/SiteRootEdit.dtml
+1
-11
lib/python/Products/SiteAccess/www/VirtualHostMonster.dtml
lib/python/Products/SiteAccess/www/VirtualHostMonster.dtml
+22
-6
No files found.
lib/python/Products/SiteAccess/AccessRule.py
View file @
d7dedb9b
...
...
@@ -16,18 +16,18 @@ class AccessRule(NameCaller):
def
__call__
(
self
,
container
,
request
):
if
SUPPRESS_ACCESSRULE
:
return
if
'_SUPPRESS_ACCESSRULE'
in
_swallow
(
request
):
if
'_SUPPRESS_ACCESSRULE'
in
_swallow
(
request
,
'_SUPPRESS'
):
request
.
setVirtualRoot
(
request
.
steps
)
return
NameCaller
.
__call__
(
self
,
container
,
request
)
def
_swallow
(
request
):
def
_swallow
(
request
,
prefix
):
path
=
request
[
'TraversalRequestNameStack'
]
steps
=
request
.
steps
i
=
len
(
steps
)
while
i
>
0
and
steps
[
i
-
1
][:
1
]
==
'_'
:
i
=
i
-
1
while
path
and
path
[
-
1
][:
1
]
==
'_'
:
while
path
and
path
[
-
1
][:
len
(
prefix
)]
==
prefix
:
steps
.
append
(
path
.
pop
())
return
steps
[
i
:]
...
...
lib/python/Products/SiteAccess/SiteRoot.py
View file @
d7dedb9b
...
...
@@ -105,7 +105,7 @@ class SiteRoot(Traverser, Implicit):
def
__call__
(
self
,
client
,
request
,
response
=
None
):
'''Traversing'''
if
SUPPRESS_SITEROOT
:
return
if
'_SUPPRESS_SITEROOT'
in
_swallow
(
request
):
if
'_SUPPRESS_SITEROOT'
in
_swallow
(
request
,
'_SUPPRESS'
):
request
.
setVirtualRoot
(
request
.
steps
)
return
srd
=
[
None
,
None
]
...
...
lib/python/Products/SiteAccess/VirtualHostMonster.py
View file @
d7dedb9b
...
...
@@ -7,10 +7,12 @@ from Globals import DTMLFile, MessageDialog, Persistent
from
OFS.SimpleItem
import
Item
from
Acquisition
import
Implicit
,
ImplicitAcquisitionWrapper
from
ExtensionClass
import
Base
from
string
import
split
,
strip
from
string
import
split
,
strip
,
join
from
ZPublisher
import
BeforeTraverse
import
os
from
AccessRule
import
_swallow
class
VirtualHostMonster
(
Persistent
,
Item
,
Implicit
):
"""Provide a simple drop-in solution for virtual hosting.
"""
...
...
@@ -74,21 +76,38 @@ class VirtualHostMonster(Persistent, Item, Implicit):
request
.
setServerURL
(
protocol
,
host
,
port
)
else
:
request
.
setServerURL
(
protocol
,
host
)
#request.setVirtualRoot([])
# Find and convert VirtualHostRoot directive
# If it is followed by one or more path elements that each
# start with '_vh_', use them to construct the path to the
# virtual root.
vh
=
-
1
for
ii
in
range
(
len
(
stack
)):
if
stack
[
ii
]
==
'VirtualHostRoot'
:
stack
[
ii
]
=
self
.
id
if
vh
>=
0
:
pp
=
[
''
]
for
jj
in
range
(
vh
,
ii
):
pp
.
insert
(
1
,
stack
[
jj
][
4
:])
stack
[
vh
:
ii
+
1
]
=
[
join
(
pp
,
'/'
),
self
.
id
]
elif
ii
>
0
and
stack
[
ii
-
1
][:
1
]
==
'/'
:
stack
[
ii
]
=
self
.
id
else
:
stack
[
ii
]
=
self
.
id
stack
.
insert
(
ii
,
'/'
)
break
elif
vh
<
0
and
stack
[
ii
][:
4
]
==
'_vh_'
:
vh
=
ii
def
__bobo_traverse__
(
self
,
request
,
name
):
'''Traversing away'''
if
name
in
(
'manage_main'
,
'manage_workspace'
)
:
return
self
.
manage_main
if
name
[:
1
]
!=
'/'
:
return
getattr
(
self
,
name
)
parents
=
request
.
PARENTS
parents
.
pop
()
# I don't belong there
request
.
setVirtualRoot
([])
stack
=
request
[
'TraversalRequestNameStack'
]
stack
.
append
(
name
)
if
len
(
name
)
>
1
:
request
.
setVirtualRoot
(
split
(
name
[
1
:],
'/'
))
else
:
request
.
setVirtualRoot
([])
return
parents
.
pop
()
# He'll get put back on
def
manage_addVirtualHostMonster
(
self
,
id
,
REQUEST
=
None
,
**
ignored
):
...
...
lib/python/Products/SiteAccess/www/SiteRootAdd.dtml
View file @
d7dedb9b
...
...
@@ -32,9 +32,7 @@ Base (if specified) should <strong>always</strong> start with
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
<td align="left" valign="top">SiteRoot</td>
</tr>
<tr>
<td align="left" valign="top">
...
...
lib/python/Products/SiteAccess/www/SiteRootEdit.dtml
View file @
d7dedb9b
...
...
@@ -25,16 +25,6 @@ Base (if specified) should <strong>always</strong> start with "http://"
<form action="manage_edit" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
...
...
@@ -64,7 +54,7 @@ Base (if specified) should <strong>always</strong> start with "http://"
</div>
</td>
<td align="left" valign="top">
<input type="text" name="path" size="40"
value="/"
<input type="text" name="path" size="40"
value="<dtml-if path>&dtml-path;</dtml-if>" />
</td>
</tr>
...
...
lib/python/Products/SiteAccess/www/VirtualHostMonster.dtml
View file @
d7dedb9b
...
...
@@ -21,22 +21,38 @@ directive, or with a Zope Access Rule.
<p class="form-help">
If the URL path of a request begins with
"/VirtualHostBase/http/www.foo.com", for instance, then
URLs generated by Zope will start with <strong>http://www.foo.com</strong>.
URLs generated by Zope will start with
<strong>http://www.foo.com</strong>.
Since the port number was not specified, it is left unchanged. If
your Zope is running on port 8080, and you want generated URLs not to
include this port number, you must use
"/VirtualHostBase/http/www.foo.com:80".
</p>
<p class="form-help">
If the URL contains <em>VirtualHostRoot</em>, then
all path elements up to that point are removed from generated URLs.
For instance, a request with path "/a/b/c/VirtualHostRoot/d"
will generate a URL with path <strong>/d</strong>.
will traverse "a/b/c/d" and then generate a URL with
path <strong>/d</strong>.
</p>
<p class="form-help">
If <em>VirtualHostRoot</em> is followed by one or more path elements
that start with '_vh_', then these elements (without the '_vh_') will
be skipped and then added to the start of generated URLs.
For instance, a request with path "/a/VirtualHostRoot/_vh_z/b"
will traverse "a/b" and then generate a URL with
path <strong>/z/b</strong>.
</p>
<p class="form-help">
Combining both allows you to cause a subfolder to act as the root of a
site. For example, to publish Folder "/foo" as
<strong>http://www.foo.com/</strong>, put a Virtual Host Monster in the root
folder and rewrite requests for that URL to
<strong>/VirtualHostBase/http/www.foo.com/foo/VirtualHostRoot/</strong>
site. For example, suppose you want to publish Folder "/foo" as
<strong>http://www.foo.com/</strong>, where Zope is running on port
8080 behind Apache running on port 80. You place a Virtual Host
Monster in the root Zope folder, and use Apache to rewrite "/(.*)"
to <strong>http://localhost:8080/VirtualHostBase/http/www.foo.com:80/foo/VirtualHostRoot/$1</strong>
</p>
<p class="form-help">
...
...
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