From 367305df9e2a4afe2dd9d31a987ca3b94b476780 Mon Sep 17 00:00:00 2001 From: Kevin Yank Date: Sun, 15 Sep 2013 15:09:31 +1000 Subject: [PATCH 1/2] Fix syntax error in Python 3.3. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “Unicode Raw” strings are no longer supported in Python 3.3, and cause a syntax error. See http://bugs.python.org/issue15096. Without this fix, Pystache gives a syntax error when used in a Python 3.3 environment. --- pystache/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pystache/parser.py b/pystache/parser.py index c6a171f0..c3c5ef09 100644 --- a/pystache/parser.py +++ b/pystache/parser.py @@ -12,7 +12,7 @@ END_OF_LINE_CHARACTERS = [u'\r', u'\n'] -NON_BLANK_RE = re.compile(ur'^(.)', re.M) +NON_BLANK_RE = re.compile(u'^(.)', re.M) # TODO: add some unit tests for this. From 76c509e72bc948d02f5a2a3797e4906864a174ba Mon Sep 17 00:00:00 2001 From: Kevin Yank Date: Sun, 15 Sep 2013 15:21:28 +1000 Subject: [PATCH 2/2] Fix another Python 3.3 syntax error. --- pystache/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pystache/parser.py b/pystache/parser.py index c3c5ef09..ae8fc0e7 100644 --- a/pystache/parser.py +++ b/pystache/parser.py @@ -147,7 +147,7 @@ def __repr__(self): def render(self, engine, context): template = engine.resolve_partial(self.key) # Indent before rendering. - template = re.sub(NON_BLANK_RE, self.indent + ur'\1', template) + template = re.sub(NON_BLANK_RE, self.indent + u'\\1', template) return engine.render(template, context)