Commit b30e1c2a by Chris Jerdonek

Removed unused delims argument from escape and unescape functions.

parent 12f5ad2b
...@@ -88,13 +88,13 @@ def inverseTag(name, parsed, template, delims): ...@@ -88,13 +88,13 @@ def inverseTag(name, parsed, template, delims):
return renderParseTree(parsed, self, delims) return renderParseTree(parsed, self, delims)
return func return func
def escapedTag(name, delims): def escape_tag_function(name):
fetch = unescapedTag(name, delims) fetch = literal_tag_function(name)
def func(self): def func(self):
return cgi.escape(fetch(self), True) return cgi.escape(fetch(self), True)
return func return func
def unescapedTag(name, delims): def literal_tag_function(name):
def func(context): def func(context):
val = context.get(name) val = context.get(name)
template = call(val=val, view=context) template = call(val=val, view=context)
...@@ -194,7 +194,8 @@ class Template(object): ...@@ -194,7 +194,8 @@ class Template(object):
self.otag, self.ctag = name.split() self.otag, self.ctag = name.split()
self._compile_regexps() self._compile_regexps()
elif captures['tag'] == '>': elif captures['tag'] == '>':
parse_tree.append(partialTag(name, captures['whitespace'])) func = partialTag(name, captures['whitespace'])
parse_tree.append(func)
elif captures['tag'] in ['#', '^']: elif captures['tag'] in ['#', '^']:
try: try:
self.parse_to_tree(template, index=end_index) self.parse_to_tree(template, index=end_index)
...@@ -208,9 +209,15 @@ class Template(object): ...@@ -208,9 +209,15 @@ class Template(object):
elif captures['tag'] == '/': elif captures['tag'] == '/':
raise EndOfSection(parse_tree, template[start_index:match_index], end_index) raise EndOfSection(parse_tree, template[start_index:match_index], end_index)
elif captures['tag'] in ['{', '&']: elif captures['tag'] in ['{', '&']:
parse_tree.append(unescapedTag(name, (self.otag, self.ctag)))
func = literal_tag_function(name)
parse_tree.append(func)
elif captures['tag'] == '': elif captures['tag'] == '':
parse_tree.append(escapedTag(name, (self.otag, self.ctag)))
func = escape_tag_function(name)
parse_tree.append(func)
else: else:
raise Exception("'%s' is an unrecognized type!" % captures['tag']) raise Exception("'%s' is an unrecognized type!" % captures['tag'])
......
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