diff options
Diffstat (limited to 'pystache/parser.py')
-rw-r--r-- | pystache/parser.py | 7 |
1 files changed, 5 insertions, 2 deletions
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) |