Commit 62b6b798 authored by Evan Simpson's avatar Evan Simpson

Allow tal:repeat="nothing", and similar.

parent 92389ef2
...@@ -8,5 +8,7 @@ Page Template changes ...@@ -8,5 +8,7 @@ Page Template changes
Features Added Features Added
- Allow any false value in tal:repeat to act as an empty sequence.
Bugs Fixed Bugs Fixed
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
An implementation of a generic TALES engine An implementation of a generic TALES engine
""" """
__version__='$Revision: 1.17 $'[11:-2] __version__='$Revision: 1.18 $'[11:-2]
import re, sys, ZTUtils import re, sys, ZTUtils
from MultiMapping import MultiMapping from MultiMapping import MultiMapping
...@@ -269,6 +269,8 @@ class Context: ...@@ -269,6 +269,8 @@ class Context:
def setRepeat(self, name, expr): def setRepeat(self, name, expr):
expr = self.evaluate(expr) expr = self.evaluate(expr)
if not expr:
return self._engine.Iterator(name, (), self)
it = self._engine.Iterator(name, expr, self) it = self._engine.Iterator(name, expr, self)
old_value = self.repeat_vars.get(name) old_value = self.repeat_vars.get(name)
self._scope_stack[-1].append((name, old_value)) self._scope_stack[-1].append((name, old_value))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment