Cleaning up the fetch routine a bit. Also deleting a bit

of unintended diagnostic code.
This commit is contained in:
Pieter van de Bruggen
2011-02-20 20:54:36 -08:00
parent 3fe3ab95e9
commit bd24077a50
+5 -6
View File
@@ -75,20 +75,19 @@ class Template(object):
captures['whitespace'] = ''
# TODO: Process the remaining tag types.
print captures['name']
fetch = lambda view: unicode(view.get(captures['name']))
fetch = lambda view: view.get(captures['name'])
if captures['tag'] == '!':
pass
elif captures['tag'] == '=':
print '"', captures['name'], '"'
self.otag, self.ctag = captures['name'].split()
self._compile_regexps()
elif captures['tag'] in ['{', '&']:
buffer.append(fetch)
buffer.append(lambda view: unicode(fetch(view)))
elif captures['tag'] == '':
buffer.append(lambda view: cgi.escape(fetch(view), True))
buffer.append(lambda view: cgi.escape(unicode(fetch(view)), True))
else:
print 'Error!'
raise
return pos