prevent infinite loop with invalid template

This commit is contained in:
Damien Elmes 2018-10-20 19:37:01 +10:00
parent b0091053bf
commit f8e1ebd4fb

View File

@ -108,7 +108,13 @@ class Template:
def render_tags(self, template, context):
"""Renders all the tags in a template for a context."""
repCount = 0
while 1:
if repCount > 100:
print("too many replacements")
break
repCount += 1
match = self.tag_re.search(template)
if match is None:
break