diff babel/catalog/extract.py @ 36:56b931b23d5b

Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
author cmlenz
date Mon, 04 Jun 2007 21:30:52 +0000
parents a2c54ef107c2
children 818646bcd90b
line wrap: on
line diff
--- a/babel/catalog/extract.py
+++ b/babel/catalog/extract.py
@@ -229,7 +229,8 @@
             elif tok == STRING:
                 if lineno is None:
                     lineno = stup[0]
-                buf.append(value[1:-1])
+                # Unwrap quotes in a safe manner
+                buf.append(eval(value, {'__builtins__':{}}, {}))
             elif tok == OP and value == ',':
                 messages.append(''.join(buf))
                 del buf[:]
Copyright (C) 2012-2017 Edgewall Software