From ea9f711c9074a09a9629e02d9508596e30fd65c8 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sun, 6 May 2012 13:19:45 -0700 Subject: Renderer.render() now accepts ParsedTemplate instances. --- pystache/parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pystache/parser.py') diff --git a/pystache/parser.py b/pystache/parser.py index 81d189a..4c37ec3 100644 --- a/pystache/parser.py +++ b/pystache/parser.py @@ -30,10 +30,13 @@ def parse(template, delimiters=None): Examples: - >>> parse("Hey {{#you}}{{name}}!{{/you}}") - ['Hey ', _SectionNode(key='you', index_begin=12, index_end=21, parsed=[_EscapeNode(key='name'), '!'])] + >>> parsed = parse(u"Hey {{#who}}{{name}}!{{/who}}") + >>> print str(parsed).replace('u', '') # This is a hack to get the test to pass both in Python 2 and 3. + ['Hey ', _SectionNode(key='who', index_begin=12, index_end=21, parsed=[_EscapeNode(key='name'), '!'])] """ + if type(template) is not unicode: + raise Exception("Template is not unicode: %s" % type(template)) parser = _Parser(delimiters) return parser.parse(template) -- cgit v1.2.1