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
b8791552
Commit
b8791552
authored
Apr 17, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- give nearly-anonymous exception a local name
- modernize a type-check
parent
a00dffc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lib/python/OFS/Traversable.py
lib/python/OFS/Traversable.py
+8
-7
No files found.
lib/python/OFS/Traversable.py
View file @
b8791552
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
##############################################################################
##############################################################################
'''This module implements a mix-in for traversable objects.
'''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.1
8 2003/02/26 16:51:46 caseman
Exp $'''
$Id: Traversable.py,v 1.1
9 2003/04/17 17:46:57 fdrake
Exp $'''
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
9
$'
[
11
:
-
2
]
from
Acquisition
import
Acquired
,
aq_inner
,
aq_parent
,
aq_base
from
Acquisition
import
Acquired
,
aq_inner
,
aq_parent
,
aq_base
...
@@ -22,8 +22,9 @@ from AccessControl import Unauthorized
...
@@ -22,8 +22,9 @@ from AccessControl import Unauthorized
from
AccessControl.ZopeGuards
import
guarded_getattr
from
AccessControl.ZopeGuards
import
guarded_getattr
from
urllib
import
quote
from
urllib
import
quote
NotFound
=
'NotFound'
_marker
=
[]
_marker
=
[]
StringType
=
type
(
''
)
class
Traversable
:
class
Traversable
:
...
@@ -75,7 +76,7 @@ class Traversable:
...
@@ -75,7 +76,7 @@ class Traversable:
N
=
None
N
=
None
M
=
_marker
M
=
_marker
if
type
(
path
)
is
StringType
:
path
=
path
.
split
(
'/'
)
if
isinstance
(
path
,
str
)
:
path
=
path
.
split
(
'/'
)
else
:
path
=
list
(
path
)
else
:
path
=
list
(
path
)
REQUEST
=
{
'TraversalRequestNameStack'
:
path
}
REQUEST
=
{
'TraversalRequestNameStack'
:
path
}
...
@@ -104,7 +105,7 @@ class Traversable:
...
@@ -104,7 +105,7 @@ class Traversable:
if
name
[
0
]
==
'_'
:
if
name
[
0
]
==
'_'
:
# Never allowed in a URL.
# Never allowed in a URL.
raise
'NotFound'
,
name
raise
NotFound
,
name
if
name
==
'..'
:
if
name
==
'..'
:
o
=
getattr
(
object
,
'aq_parent'
,
M
)
o
=
getattr
(
object
,
'aq_parent'
,
M
)
...
@@ -143,8 +144,8 @@ class Traversable:
...
@@ -143,8 +144,8 @@ class Traversable:
try
:
try
:
o
=
object
[
name
]
o
=
object
[
name
]
except
AttributeError
:
except
AttributeError
:
# Raise
a
NotFound for easier debugging
# Raise NotFound for easier debugging
raise
'NotFound'
,
name
raise
NotFound
,
name
if
(
restricted
and
not
securityManager
.
validate
(
if
(
restricted
and
not
securityManager
.
validate
(
object
,
object
,
N
,
o
)):
object
,
object
,
N
,
o
)):
raise
Unauthorized
,
name
raise
Unauthorized
,
name
...
...
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