[PATCH] add support for getVirtualRoot() or similar to the REQUEST object
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Fix Released
|
Low
|
Unassigned |
Bug Description
Similarly to:
https:/
It is very useful (in fact, necessary in certain scenarios) to have access to the virtual root/path information that is stored in the _script attribute of the REQUEST object.
For example, it may be useful to set a Zope-specific cookie for a domain where multiple systems share the domain name; if Zope lives at:
http://
then when setting cookies, you want to be able to specify the path of '/zope' for the cookie. Zope session cookies, for example, would need this ability if you had, eg:
http://
http://
for two different systems both being powered by Zope.
Or, similarly, with ESI setups or similar, you may want to be able to turn out pages that make all links look like: "/url/path" instead of "http://
Exposing access to the _script attribute is relatively trivial, a method similar to the following inside HTTPRequest.py would be sufficient:
def getVirtualRoot(
x = '/' + '/'.join(
if x == '/':
x = ''
# Could also be set to x = '/.', but that may be misleading...
return x
Changed in zope2: | |
importance: | Undecided → Wishlist |
Changed in zope2: | |
status: | Fix Committed → Fix Released |
The patch requires a unittest.