diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-05-06 13:19:45 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-05-06 13:19:45 -0700 |
commit | ea9f711c9074a09a9629e02d9508596e30fd65c8 (patch) | |
tree | 76aa3cd3493d397a465ef3c32178c93f26a8a2bf /pystache/parser.py | |
parent | a4a9413a52afe9960df41f3f71e6d3d1d0eddb32 (diff) | |
download | pystache-ea9f711c9074a09a9629e02d9508596e30fd65c8.tar.gz |
Renderer.render() now accepts ParsedTemplate instances.
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) |