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
3f2cdc69
Commit
3f2cdc69
authored
Aug 19, 2010
by
Jens Vagelpohl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- LP #193122: New method getVirtualRoot added to the Request class
parent
72e68c0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
doc/CHANGES.rst
doc/CHANGES.rst
+2
-0
src/ZPublisher/HTTPRequest.py
src/ZPublisher/HTTPRequest.py
+7
-0
src/ZPublisher/tests/testHTTPRequest.py
src/ZPublisher/tests/testHTTPRequest.py
+10
-0
No files found.
doc/CHANGES.rst
View file @
3f2cdc69
...
@@ -16,6 +16,8 @@ Bugs Fixed
...
@@ -16,6 +16,8 @@ Bugs Fixed
Features Added
Features Added
++++++++++++++
++++++++++++++
- LP #193122: New method getVirtualRoot added to the Request class
- Added forward-compatibility shims for some frequently used modules moved in
- Added forward-compatibility shims for some frequently used modules moved in
Zope 2.13.
Zope 2.13.
...
...
src/ZPublisher/HTTPRequest.py
View file @
3f2cdc69
...
@@ -232,6 +232,13 @@ class HTTPRequest(BaseRequest):
...
@@ -232,6 +232,13 @@ class HTTPRequest(BaseRequest):
other
[
'VirtualRootPhysicalPath'
]
=
parents
[
-
1
].
getPhysicalPath
()
other
[
'VirtualRootPhysicalPath'
]
=
parents
[
-
1
].
getPhysicalPath
()
self
.
_resetURLS
()
self
.
_resetURLS
()
def
getVirtualRoot
(
self
):
""" Return a slash-separated virtual root.
If it is same as the physical root, return ''.
"""
return
'/'
.
join
([
''
]
+
self
.
_script
)
def
physicalPathToVirtualPath
(
self
,
path
):
def
physicalPathToVirtualPath
(
self
,
path
):
""" Remove the path to the VirtualRoot from a physical path """
""" Remove the path to the VirtualRoot from a physical path """
if
type
(
path
)
is
type
(
''
):
if
type
(
path
)
is
type
(
''
):
...
...
src/ZPublisher/tests/testHTTPRequest.py
View file @
3f2cdc69
...
@@ -1029,6 +1029,16 @@ class HTTPRequestTests(unittest.TestCase):
...
@@ -1029,6 +1029,16 @@ class HTTPRequestTests(unittest.TestCase):
'{"intkey":123,"stringkey":"blah"}'
)
'{"intkey":123,"stringkey":"blah"}'
)
self
.
assertEquals
(
req
.
cookies
[
'anothercookie'
],
'boring'
)
self
.
assertEquals
(
req
.
cookies
[
'anothercookie'
],
'boring'
)
def
test_getVirtualRoot
(
self
):
# https://bugs.launchpad.net/zope2/+bug/193122
req
=
self
.
_makeOne
()
req
.
_script
=
[]
self
.
assertEquals
(
req
.
getVirtualRoot
(),
''
)
req
.
_script
=
[
'foo'
,
'bar'
]
self
.
assertEquals
(
req
.
getVirtualRoot
(),
'/foo/bar'
)
TEST_ENVIRON
=
{
TEST_ENVIRON
=
{
'CONTENT_TYPE'
:
'multipart/form-data; boundary=12345'
,
'CONTENT_TYPE'
:
'multipart/form-data; boundary=12345'
,
'REQUEST_METHOD'
:
'POST'
,
'REQUEST_METHOD'
:
'POST'
,
...
...
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