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
2e7ac9cc
Commit
2e7ac9cc
authored
Jun 08, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
317719b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+9
-9
No files found.
lib/python/Products/PageTemplates/Expressions.py
View file @
2e7ac9cc
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths.
for Python expressions, string literals, and paths.
"""
"""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
re
,
sys
import
re
,
sys
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
,
\
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
,
\
...
@@ -171,7 +171,7 @@ class PathExpr:
...
@@ -171,7 +171,7 @@ class PathExpr:
dp
.
reverse
()
dp
.
reverse
()
return
base
,
path
,
dp
return
base
,
path
,
dp
def
_eval
(
self
,
(
base
,
path
,
dp
),
econtext
,
def
_eval
(
self
,
(
base
,
path
,
dp
),
econtext
,
securityManager
,
list
=
list
,
isinstance
=
isinstance
,
StringType
=
type
(
''
)):
list
=
list
,
isinstance
=
isinstance
,
StringType
=
type
(
''
)):
path
=
list
(
path
)
# Copy!
path
=
list
(
path
)
# Copy!
contexts
=
econtext
.
contexts
contexts
=
econtext
.
contexts
...
@@ -193,14 +193,18 @@ class PathExpr:
...
@@ -193,14 +193,18 @@ class PathExpr:
has
,
ob
=
var
.
has_get
(
base
)
has
,
ob
=
var
.
has_get
(
base
)
if
not
has
:
if
not
has
:
ob
=
contexts
[
base
]
ob
=
contexts
[
base
]
return
restrictedTraverse
(
ob
,
path
)
if
path
:
return
restrictedTraverse
(
ob
,
path
,
securityManager
)
else
:
return
ob
except
(
AttributeError
,
KeyError
,
TypeError
,
IndexError
,
except
(
AttributeError
,
KeyError
,
TypeError
,
IndexError
,
'Unauthorized'
),
e
:
'Unauthorized'
),
e
:
return
Undefined
(
self
.
_s
,
sys
.
exc_info
())
return
Undefined
(
self
.
_s
,
sys
.
exc_info
())
def
__call__
(
self
,
econtext
):
def
__call__
(
self
,
econtext
):
securityManager
=
getSecurityManager
()
for
pathinfo
in
self
.
_paths
:
for
pathinfo
in
self
.
_paths
:
ob
=
self
.
_eval
(
pathinfo
,
econtext
)
ob
=
self
.
_eval
(
pathinfo
,
econtext
,
securityManager
)
exists
=
not
isinstance
(
ob
,
Undefined
)
exists
=
not
isinstance
(
ob
,
Undefined
)
if
exists
:
if
exists
:
...
@@ -271,13 +275,9 @@ class NotExpr:
...
@@ -271,13 +275,9 @@ class NotExpr:
return
'<NotExpr %s>'
%
`self._s`
return
'<NotExpr %s>'
%
`self._s`
def
restrictedTraverse
(
self
,
path
,
def
restrictedTraverse
(
self
,
path
,
securityManager
,
get
=
getattr
,
has
=
hasattr
,
N
=
None
,
M
=
[]):
get
=
getattr
,
has
=
hasattr
,
N
=
None
,
M
=
[]):
if
not
path
:
return
self
securityManager
=
getSecurityManager
()
i
=
0
i
=
0
if
not
path
[
0
]:
if
not
path
[
0
]:
# If the path starts with an empty string, go to the root first.
# If the path starts with an empty string, go to the root first.
...
...
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