summaryrefslogtreecommitdiff
path: root/src/zope/tales/expressions.py
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2022-08-07 13:44:07 +0100
committerColin Watson <cjwatson@canonical.com>2022-08-07 13:44:07 +0100
commit859456919f9df4acb5e902e2b88cc4e612a3024c (patch)
treeae6248ad179d6c19767091b824c4b089948ea98d /src/zope/tales/expressions.py
parent4d490966549c43e56a6a5aaf17955922ad15ad18 (diff)
downloadzope-tales-859456919f9df4acb5e902e2b88cc4e612a3024c.tar.gz
Fix "Invalid variable name" error for base of path
If you were aiming for this TAL fragment: <p class="error message" tal:condition="view/error_message" tal:content="structure view/error_message/escapedtext" /> ... but instead mistype it as this: <p class="error message" tal:condition="view/error_message" tal:content="structured view/error_message/escapedtext" /> ... then you get this very confusing exception: zope.tal.taldefs.TALError: Invalid variable name "escapedtext" in expression 'structured view/error_message/escapedtext', at ... But "escapedtext" is not the invalid name here; it's "structured view", because the typo of "structured" for "structure" means that `zope.tal` doesn't interpret that part of the attribute before passing it on to `zope.tales` to evaluate the path expression. Fix the incorrect error message.
Diffstat (limited to 'src/zope/tales/expressions.py')
-rw-r--r--src/zope/tales/expressions.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/zope/tales/expressions.py b/src/zope/tales/expressions.py
index dd8980c..18db2b1 100644
--- a/src/zope/tales/expressions.py
+++ b/src/zope/tales/expressions.py
@@ -124,7 +124,7 @@ class SubPathExpr(object):
base = first[0]
if base and not _valid_name(base):
raise engine.getCompilerError()(
- 'Invalid variable name "%s"' % element)
+ 'Invalid variable name "%s"' % base)
self._base = base
compiledpath[0] = first[1:]
self._compiled_path = tuple(compiledpath)