aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent DAVERIO <daverio@Vialfre>2015-05-11 16:18:48 +0200
committerLaurent DAVERIO <daverio@Vialfre>2015-05-11 16:18:48 +0200
commit42d611f533440b21ee857e0739855d03d05caaa3 (patch)
tree7e26d7bcd380cd8229942f8a37163800aa3cee07
parent8febe540b571f45b23884a27ed9d149f2de2a31d (diff)
downloadexternal_python_mako-42d611f533440b21ee857e0739855d03d05caaa3.tar.gz
external_python_mako-42d611f533440b21ee857e0739855d03d05caaa3.tar.bz2
external_python_mako-42d611f533440b21ee857e0739855d03d05caaa3.zip
Fix a string vs. bytes error under Python 3. Thanks Tim Tisdall for noticing and fixing the problem.
-rw-r--r--mako/ext/linguaplugin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mako/ext/linguaplugin.py b/mako/ext/linguaplugin.py
index 8126df3..aba039c 100644
--- a/mako/ext/linguaplugin.py
+++ b/mako/ext/linguaplugin.py
@@ -26,9 +26,9 @@ class LinguaMakoExtractor(Extractor, MessageExtractor):
def process_python(self, code, code_lineno, translator_strings):
source = code.getvalue().strip()
if source.endswith(compat.b(':')):
- if source in ('try:', 'else:') or source.startswith('except'):
+ if source in (compat.b('try:'), compat.b('else:')) or source.startswith(compat.b('except')):
source = compat.b('') # Ignore try/except and else
- elif source.startswith('elif'):
+ elif source.startswith(compat.b('elif')):
source = source[2:] # Replace "elif" with "if"
source += compat.b('pass')
code = io.BytesIO(source)