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
7e13514d
Commit
7e13514d
authored
Aug 13, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up exception handling
parent
cd7d2a45
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
12 deletions
+30
-12
lib/python/Products/PageTemplates/CHANGES.txt
lib/python/Products/PageTemplates/CHANGES.txt
+4
-0
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+2
-1
lib/python/Products/PageTemplates/TALES.py
lib/python/Products/PageTemplates/TALES.py
+16
-9
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+8
-2
lib/python/Products/PageTemplates/examples/zpt_examples.zexp
lib/python/Products/PageTemplates/examples/zpt_examples.zexp
+0
-0
No files found.
lib/python/Products/PageTemplates/CHANGES.txt
View file @
7e13514d
...
...
@@ -17,3 +17,7 @@ Page Template changes
- Expressions with embedded newlines were broken
- History comparison tried to expand macros
- Iterator exceptions weren't converted
- 'Unauthorized' exception couldn't be handled by on-error
lib/python/Products/PageTemplates/Expressions.py
View file @
7e13514d
...
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths.
"""
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
9
$'
[
11
:
-
2
]
import
re
,
sys
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
,
\
...
...
@@ -103,6 +103,7 @@ def getEngine():
if
_engine
is
None
:
_engine
=
Engine
()
installHandlers
(
_engine
)
_engine
.
_nocatch
=
(
TALESError
,
'Redirect'
)
return
_engine
def
installHandlers
(
engine
):
...
...
lib/python/Products/PageTemplates/TALES.py
View file @
7e13514d
...
...
@@ -87,7 +87,7 @@
An implementation of a generic TALES engine
"""
__version__
=
'$Revision: 1.
19
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
20
$'
[
11
:
-
2
]
import
re
,
sys
,
ZTUtils
from
MultiMapping
import
MultiMapping
...
...
@@ -158,9 +158,15 @@ class Iterator(ZTUtils.Iterator):
self
.
_context
=
context
def
next
(
self
):
if
ZTUtils
.
Iterator
.
next
(
self
):
self
.
_context
.
setLocal
(
self
.
name
,
self
.
seq
[
self
.
index
])
return
1
try
:
if
ZTUtils
.
Iterator
.
next
(
self
):
self
.
_context
.
setLocal
(
self
.
name
,
self
.
seq
[
self
.
index
])
return
1
except
TALESError
:
raise
except
:
raise
TALESError
,
(
'repeat/%s'
%
self
.
name
,
sys
.
exc_info
()),
sys
.
exc_info
()[
2
]
return
0
...
...
@@ -224,9 +230,12 @@ class Context:
'''
_context_class
=
SafeMapping
_nocatch
=
TALESError
def
__init__
(
self
,
engine
,
contexts
):
self
.
_engine
=
engine
if
hasattr
(
engine
,
'_nocatch'
):
self
.
_nocatch
=
engine
.
_nocatch
self
.
contexts
=
contexts
contexts
[
'nothing'
]
=
None
contexts
[
'default'
]
=
Default
...
...
@@ -284,15 +293,13 @@ class Context:
expression
=
self
.
_engine
.
compile
(
expression
)
try
:
v
=
expression
(
self
)
except
TALESError
:
if
isinstance
(
v
,
Exception
):
raise
v
except
self
.
_nocatch
:
raise
except
:
if
sys
.
exc_info
()[
0
]
in
(
'Redirect'
,
'Unauthorized'
):
raise
raise
TALESError
,
(
`expression`
,
sys
.
exc_info
()),
sys
.
exc_info
()[
2
]
else
:
if
isinstance
(
v
,
Exception
):
raise
v
return
v
evaluateValue
=
evaluate
...
...
lib/python/Products/PageTemplates/ZopePageTemplate.py
View file @
7e13514d
...
...
@@ -87,7 +87,7 @@
Zope object encapsulating a Page Template.
"""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
os
,
AccessControl
,
Acquisition
,
sys
from
Globals
import
DTMLFile
,
MessageDialog
,
package_home
...
...
@@ -103,6 +103,7 @@ from OFS.Cache import Cacheable
from
OFS.Traversable
import
Traversable
from
OFS.PropertyManager
import
PropertyManager
from
PageTemplate
import
PageTemplate
from
TALES
import
TALESError
try
:
from
webdav.Lockable
import
ResourceLockedError
...
...
@@ -262,7 +263,12 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
# Execute the template in a new security context.
security
.
addContext
(
self
)
try
:
result
=
self
.
pt_render
(
extra_context
=
bound_names
)
try
:
result
=
self
.
pt_render
(
extra_context
=
bound_names
)
except
TALESError
,
err
:
if
err
.
type
==
'Unauthorized'
:
raise
err
.
type
,
err
.
value
raise
if
keyset
is
not
None
:
# Store the result in the cache.
self
.
ZCacheable_set
(
result
,
keywords
=
keyset
)
...
...
lib/python/Products/PageTemplates/examples/zpt_examples.zexp
View file @
7e13514d
No preview for this file type
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