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
923158b1
Commit
923158b1
authored
Nov 06, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ZPT use Unauthorized, when it's available.
parent
08081107
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+13
-9
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+4
-3
No files found.
lib/python/Products/PageTemplates/Expressions.py
View file @
923158b1
...
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths.
"""
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
4
$'
[
11
:
-
2
]
import
re
,
sys
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
,
\
...
...
@@ -118,7 +118,7 @@ def installHandlers(engine):
if
sys
.
modules
.
has_key
(
'Zope'
):
import
AccessControl
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
,
Unauthorized
if
hasattr
(
AccessControl
,
'full_read_guard'
):
from
ZRPythonExpr
import
PythonExpr
,
_SecureModuleImporter
,
\
call_with_ns
...
...
@@ -128,6 +128,10 @@ if sys.modules.has_key('Zope'):
SecureModuleImporter
=
_SecureModuleImporter
()
else
:
from
PythonExpr
import
getSecurityManager
,
PythonExpr
try
:
from
zExceptions
import
Unauthorized
except
ImportError
:
Unauthorized
=
"Unauthorized"
def
call_with_ns
(
f
,
ns
,
arg
=
1
):
if
arg
==
2
:
return
f
(
None
,
ns
)
...
...
@@ -206,7 +210,7 @@ class PathExpr:
except
Undefined
,
e
:
ob
=
e
except
(
AttributeError
,
KeyError
,
TypeError
,
IndexError
,
'Unauthorized'
),
e
:
Unauthorized
),
e
:
ob
=
Undefined
(
self
.
_s
,
sys
.
exc_info
())
if
self
.
_name
==
'exists'
:
...
...
@@ -311,7 +315,7 @@ def restrictedTraverse(self, path, securityManager,
# If the path starts with an empty string, go to the root first.
self
=
self
.
getPhysicalRoot
()
if
not
securityManager
.
validateValue
(
self
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
i
=
1
plen
=
len
(
path
)
...
...
@@ -331,7 +335,7 @@ def restrictedTraverse(self, path, securityManager,
o
=
get
(
object
,
'aq_parent'
,
M
)
if
o
is
not
M
:
if
not
validate
(
object
,
object
,
name
,
o
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
object
=
o
continue
...
...
@@ -346,7 +350,7 @@ def restrictedTraverse(self, path, securityManager,
and
get
(
object
,
name
)
==
o
):
container
=
object
if
not
validate
(
object
,
container
,
name
,
o
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
else
:
o
=
get
(
object
,
name
,
M
)
if
o
is
not
M
:
...
...
@@ -356,14 +360,14 @@ def restrictedTraverse(self, path, securityManager,
name
,
validate2
,
validate
)
else
:
if
not
validate
(
object
,
object
,
name
,
o
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
else
:
try
:
o
=
object
[
name
]
except
(
AttributeError
,
TypeError
):
raise
AttributeError
,
name
if
not
validate
(
object
,
object
,
name
,
o
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
object
=
o
return
object
...
...
@@ -371,5 +375,5 @@ def restrictedTraverse(self, path, securityManager,
def
validate2
(
orig
,
inst
,
name
,
v
,
real_validate
):
if
not
real_validate
(
orig
,
inst
,
name
,
v
):
raise
'Unauthorized'
,
name
raise
Unauthorized
,
name
return
1
lib/python/Products/PageTemplates/ZopePageTemplate.py
View file @
923158b1
...
...
@@ -87,7 +87,7 @@
Zope object encapsulating a Page Template.
"""
__version__
=
'$Revision: 1.2
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
6
$'
[
11
:
-
2
]
import
os
,
AccessControl
,
Acquisition
,
sys
from
Globals
import
DTMLFile
,
ImageFile
,
MessageDialog
,
package_home
...
...
@@ -97,7 +97,7 @@ from DateTime.DateTime import DateTime
from
string
import
join
,
strip
,
rstrip
,
split
,
replace
,
lower
from
Shared.DC.Scripts.Script
import
Script
,
BindingsUI
from
Shared.DC.Scripts.Signature
import
FuncCode
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
,
Unauthorized
from
OFS.History
import
Historical
,
html_diff
from
OFS.Cache
import
Cacheable
from
OFS.Traversable
import
Traversable
...
...
@@ -274,7 +274,8 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
try
:
result
=
self
.
pt_render
(
extra_context
=
bound_names
)
except
TALESError
,
err
:
if
err
.
type
==
'Unauthorized'
:
if
(
err
.
type
==
Unauthorized
or
isinstance
(
err
.
type
,
Unauthorized
)):
raise
err
.
type
,
err
.
value
,
err
.
takeTraceback
()
err
.
takeTraceback
()
raise
...
...
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