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
c4f758de
Commit
c4f758de
authored
Jun 12, 2000
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the absolute_url() method to Traversable.
parent
df3dbe39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
37 deletions
+22
-37
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+2
-34
lib/python/OFS/Traversable.py
lib/python/OFS/Traversable.py
+20
-3
No files found.
lib/python/OFS/SimpleItem.py
View file @
c4f758de
...
...
@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
$Id: SimpleItem.py,v 1.7
7 2000/06/12 19:36:37
shane Exp $'''
__version__
=
'$Revision: 1.7
7
$'
[
11
:
-
2
]
$Id: SimpleItem.py,v 1.7
8 2000/06/12 19:49:48
shane Exp $'''
__version__
=
'$Revision: 1.7
8
$'
[
11
:
-
2
]
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
,
App
.
Undo
import
AccessControl.Role
,
AccessControl
.
Owned
,
App
.
Common
...
...
@@ -101,7 +101,6 @@ from CopySupport import CopySource
from
string
import
join
,
lower
,
find
,
split
from
types
import
InstanceType
,
StringType
from
ComputedAttribute
import
ComputedAttribute
from
urllib
import
quote
from
AccessControl
import
getSecurityManager
from
Traversable
import
Traversable
...
...
@@ -334,21 +333,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
def
__len__
(
self
):
return
1
def
absolute_url
(
self
,
relative
=
0
):
req
=
self
.
REQUEST
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
:])
if
relative
:
# Deprecated - use getPhysicalPath
return
join
(
path
,
'/'
)
return
join
([
req
[
'SERVER_URL'
]]
+
req
.
_script
+
path
,
'/'
)
Globals
.
default__class_init__
(
Item
)
...
...
@@ -370,22 +354,6 @@ class Item_w__name__(Item):
def
_setId
(
self
,
id
):
self
.
__name__
=
id
def
absolute_url
(
self
,
relative
=
0
):
req
=
self
.
REQUEST
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
:])
if
relative
:
# This is useful for physical path relative to a VirtualRoot
return
join
(
path
,
'/'
)
return
join
([
req
[
'SERVER_URL'
]]
+
req
.
_script
+
path
,
'/'
)
def
getPhysicalPath
(
self
):
'''Returns a path (an immutable sequence of strings)
that can be used to access this object again
...
...
lib/python/OFS/Traversable.py
View file @
c4f758de
...
...
@@ -84,19 +84,36 @@
##############################################################################
'''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.
1 2000/06/12 19:36:37
shane Exp $'''
__version__
=
'$Revision: 1.
1
$'
[
11
:
-
2
]
$Id: Traversable.py,v 1.
2 2000/06/12 19:49:48
shane Exp $'''
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
import
Acquisition
from
AccessControl
import
getSecurityManager
from
string
import
split
from
string
import
split
,
join
from
urllib
import
quote
_marker
=
[]
StringType
=
type
(
''
)
class
Traversable
:
def
absolute_url
(
self
,
relative
=
0
):
req
=
self
.
REQUEST
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
:])
if
relative
:
# This is useful for physical path relative to a VirtualRoot
return
join
(
path
,
'/'
)
return
join
([
req
[
'SERVER_URL'
]]
+
req
.
_script
+
path
,
'/'
)
getPhysicalRoot
=
Acquisition
.
Acquired
getPhysicalRoot__roles__
=
()
...
...
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