[Checkins] SVN: z3c.pt/trunk/ Fixed issue where symbol mapping would not be carried through under a negation (not).
Malthe Borch
mborch at gmail.com
Fri Feb 13 11:17:17 EST 2009
Log message for revision 96494:
Fixed issue where symbol mapping would not be carried through under a negation (not).
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/src/z3c/pt/README.txt
U z3c.pt/trunk/src/z3c/pt/expressions.py
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2009-02-13 15:56:10 UTC (rev 96493)
+++ z3c.pt/trunk/CHANGES.txt 2009-02-13 16:17:17 UTC (rev 96494)
@@ -3,6 +3,9 @@
In next version
+- Fixed issue where symbol mapping would not be carried through under
+ a negation (not). [malthe]
+
- Optimize simple case: if path expression is a single path and path
is 'nothing' or has 'nocall:', just return value as-is, without
going through path_traverse. [sidnei]
Modified: z3c.pt/trunk/src/z3c/pt/README.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/README.txt 2009-02-13 15:56:10 UTC (rev 96493)
+++ z3c.pt/trunk/src/z3c/pt/README.txt 2009-02-13 16:17:17 UTC (rev 96494)
@@ -268,3 +268,14 @@
<span>No</span>
<span>No</span>
</div>
+
+Using 'exists:' in conjunction with a negation:
+
+ >>> print PageTemplate("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml">
+ ... <span tal:condition="not:exists:options/nope"
+ ... >I don't exist?</span>
+ ... </div>""")()
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <span>I don't exist?</span>
+ </div>
Modified: z3c.pt/trunk/src/z3c/pt/expressions.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/expressions.py 2009-02-13 15:56:10 UTC (rev 96493)
+++ z3c.pt/trunk/src/z3c/pt/expressions.py 2009-02-13 16:17:17 UTC (rev 96494)
@@ -221,14 +221,15 @@
parts = []
for part in value:
factory = type(part)
- parts.append(
- factory("not(%s)" % part))
+ value = factory("not(%s)" % part)
+ value.symbol_mapping.update(part.symbol_mapping)
+ parts.append(value)
if len(parts) == 1:
return parts[0]
-
+
return types.parts(parts)
-
+
class ProviderTranslator(expressions.ExpressionTranslator):
provider_regex = re.compile(r'^[A-Za-z][A-Za-z0-9_\.-]*$')
More information about the Checkins
mailing list