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
42eb8e58
Commit
42eb8e58
authored
Jan 02, 2001
by
Christopher Petrilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged in changes for path management, adding method
physicalPathToVirtualPath to the REQUEST object.
parent
acb3d074
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+23
-1
No files found.
lib/python/ZPublisher/HTTPRequest.py
View file @
42eb8e58
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__version__
=
'$Revision: 1.4
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
2
$'
[
11
:
-
2
]
import
regex
,
re
,
sys
,
os
,
string
,
urllib
from
string
import
lower
,
atoi
,
rfind
,
split
,
strip
,
join
,
upper
,
find
...
...
@@ -221,6 +221,28 @@ class HTTPRequest(BaseRequest):
other
[
'VirtualRootPhysicalPath'
]
=
parents
[
-
1
].
getPhysicalPath
()
self
.
_resetURLS
()
def
physicalPathToVirtualPath
(
self
,
path
):
""" Remove the path to the VirtualRoot from a physical path """
if
type
(
path
)
is
type
(
''
):
path
=
split
(
path
,
'/'
)
rpp
=
self
.
other
.
get
(
'VirtualRootPhysicalPath'
,
(
''
,))
i
=
0
for
name
in
rpp
[:
len
(
path
)]:
if
path
[
i
]
==
name
:
i
=
i
+
1
else
:
break
return
path
[
i
:]
def
physicalPathToURL
(
self
,
path
,
relative
=
0
):
""" Convert a physical path into a URL in the current context """
path
=
self
.
_script
+
map
(
quote
,
self
.
physicalPathToVirtualPath
(
path
))
if
relative
:
path
.
insert
(
0
,
''
)
else
:
path
.
insert
(
0
,
self
[
'SERVER_URL'
])
return
join
(
path
,
'/'
)
def
_resetURLS
(
self
):
other
=
self
.
other
other
[
'URL'
]
=
join
([
other
[
'SERVER_URL'
]]
+
self
.
_script
+
...
...
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