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
a745ce58
Commit
a745ce58
authored
Jul 23, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with expressions containing newlines.
parent
cfe8ff8d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
lib/python/Products/PageTemplates/CHANGES.txt
lib/python/Products/PageTemplates/CHANGES.txt
+1
-0
lib/python/Products/PageTemplates/PythonExpr.py
lib/python/Products/PageTemplates/PythonExpr.py
+3
-2
lib/python/Products/PageTemplates/TALES.py
lib/python/Products/PageTemplates/TALES.py
+4
-3
lib/python/Products/PageTemplates/tests/testExpressions.py
lib/python/Products/PageTemplates/tests/testExpressions.py
+1
-0
No files found.
lib/python/Products/PageTemplates/CHANGES.txt
View file @
a745ce58
...
...
@@ -10,3 +10,4 @@ Page Template changes
Bugs Fixed
- Expressions with embedded newlines were broken
lib/python/Products/PageTemplates/PythonExpr.py
View file @
a745ce58
...
...
@@ -86,10 +86,11 @@
"""Generic Python Expression Handler
"""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
from
TALES
import
CompilerError
from
string
import
strip
,
split
,
join
,
replace
,
lstrip
from
sys
import
exc_info
class
getSecurityManager
:
'''Null security manager'''
...
...
@@ -106,7 +107,7 @@ class PythonExpr:
self
.
_f
=
d
[
'f'
]
except
:
raise
CompilerError
,
(
'Python expression error:
\
n
'
'%s: %s'
)
%
sys
.
exc_info
()[:
2
]
'%s: %s'
)
%
exc_info
()[:
2
]
self
.
_get_used_names
()
def
_get_used_names
(
self
):
...
...
lib/python/Products/PageTemplates/TALES.py
View file @
a745ce58
...
...
@@ -87,7 +87,7 @@
An implementation of a generic TALES engine
"""
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
9
$'
[
11
:
-
2
]
import
re
,
sys
,
ZTUtils
from
MultiMapping
import
MultiMapping
...
...
@@ -95,7 +95,7 @@ from MultiMapping import MultiMapping
StringType
=
type
(
''
)
NAME_RE
=
r"[a-zA-Z][a-zA-Z0-9_]*"
_parse_expr
=
re
.
compile
(
r"(%s):
(.*)
"
%
NAME_RE
).
match
_parse_expr
=
re
.
compile
(
r"(%s):"
%
NAME_RE
).
match
_valid_name
=
re
.
compile
(
'%s$'
%
NAME_RE
).
match
class
TALESError
(
Exception
):
...
...
@@ -195,7 +195,8 @@ class Engine:
def
compile
(
self
,
expression
):
m
=
_parse_expr
(
expression
)
if
m
:
type
,
expr
=
m
.
group
(
1
,
2
)
type
=
m
.
group
(
1
)
expr
=
expression
[
m
.
end
():]
else
:
type
=
"standard"
expr
=
expression
...
...
lib/python/Products/PageTemplates/tests/testExpressions.py
View file @
a745ce58
...
...
@@ -15,6 +15,7 @@ class ExpressionTests(unittest.TestCase):
e
.
compile
(
'string:A$B'
)
e
.
compile
(
'string:a ${x/y} b ${y/z} c'
)
e
.
compile
(
'python: 2 + 2'
)
e
.
compile
(
'python: 2
\
n
+
\
n
2
\
n
'
)
def
test_suite
():
return
unittest
.
makeSuite
(
ExpressionTests
)
...
...
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