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
48728f92
Commit
48728f92
authored
Jul 08, 2003
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #797 and #809 -- delegate absolute_url internals to REQUEST and
provide a docstring.
parent
8f3979d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
23 deletions
+34
-23
doc/CHANGES.txt
doc/CHANGES.txt
+5
-0
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+17
-7
lib/python/OFS/Traversable.py
lib/python/OFS/Traversable.py
+12
-16
No files found.
doc/CHANGES.txt
View file @
48728f92
...
...
@@ -71,6 +71,11 @@ Zope Changes
Bugs Fixed
- Collector: #797 and #809: Application and Traversable now
delegate computation of absolute_url to the REQUEST object, and
both provide the same docstring. This makes absolute_url
callable by URL, and fixes virtual hosting inconsistencies.
- Collector: #964: standard_error_message refers to looking into the
HTML code for more information which is deprecated. Referring to
the error log now.
...
...
lib/python/OFS/Application.py
View file @
48728f92
...
...
@@ -12,8 +12,8 @@
##############################################################################
__doc__
=
'''Application support
$Id: Application.py,v 1.19
1 2003/06/24 13:30:29 chrism
Exp $'''
__version__
=
'$Revision: 1.19
1
$'
[
11
:
-
2
]
$Id: Application.py,v 1.19
2 2003/07/08 17:03:52 evan
Exp $'''
__version__
=
'$Revision: 1.19
2
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
import
time
,
traceback
,
os
,
Products
...
...
@@ -135,11 +135,21 @@ class Application(Globals.ApplicationDefaultPermissions,
test_url
=
ZopeAttributionButton
def
absolute_url
(
self
,
relative
=
0
):
"""Return an absolute url to the object. Note that the url
will reflect the acquisition path of the object if the object
has been acquired."""
if
relative
:
return
''
return
self
.
aq_acquire
(
'REQUEST'
)[
'BASE1'
]
'''Return a canonical URL for this object based on its
physical containment path, possibly modified by virtual hosting.
If the optional 'relative' argument is true, only return the
path portion of the URL.'''
try
:
# We need a REQUEST that uses physicalPathToURL to create
# BASE1 and BASEPATH1, so probe for it.
req
=
self
.
REQUEST
req
.
physicalPathToURL
except
AttributeError
:
return
''
# Take advantage of computed URL cache
if
relative
:
return
req
[
'BASEPATH1'
][
1
:]
return
req
[
'BASE1'
]
def
getPhysicalPath
(
self
):
'''Returns a path that can be used to access this object again
...
...
lib/python/OFS/Traversable.py
View file @
48728f92
...
...
@@ -12,8 +12,8 @@
##############################################################################
'''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.
19 2003/04/17 17:46:57 fdrake
Exp $'''
__version__
=
'$Revision: 1.
19
$'
[
11
:
-
2
]
$Id: Traversable.py,v 1.
20 2003/07/08 17:03:52 evan
Exp $'''
__version__
=
'$Revision: 1.
20
$'
[
11
:
-
2
]
from
Acquisition
import
Acquired
,
aq_inner
,
aq_parent
,
aq_base
...
...
@@ -30,23 +30,19 @@ class Traversable:
absolute_url__roles__
=
None
# Public
def
absolute_url
(
self
,
relative
=
0
):
'''Return a canonical URL for this object based on its
physical containment path, possibly modified by virtual hosting.
If the optional 'relative' argument is true, only return the
path portion of the URL.'''
spp
=
self
.
getPhysicalPath
()
try
:
req
=
self
.
REQUEST
toUrl
=
self
.
REQUEST
.
physicalPathToURL
except
AttributeError
:
req
=
{}
rpp
=
req
.
get
(
'VirtualRootPhysicalPath'
,
(
''
,))
spp
=
self
.
getPhysicalPath
()
i
=
0
for
name
in
rpp
[:
len
(
spp
)]:
if
spp
[
i
]
==
name
:
i
=
i
+
1
else
:
break
path
=
map
(
quote
,
spp
[
i
:])
return
'/'
.
join
(
map
(
quote
,
spp
[
1
:]))
if
relative
:
#
This is useful for physical path relative to a VirtualRoot
return
'/'
.
join
(
path
)
return
'/'
.
join
([
req
[
'SERVER_URL'
]]
+
req
.
_script
+
path
)
#
Remove leading slash for backward compatibility sake.
return
toUrl
(
spp
,
relative
)[
1
:]
return
toUrl
(
spp
)
getPhysicalRoot__roles__
=
()
# Private
getPhysicalRoot
=
Acquired
...
...
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