[FIX] avoid a bug when look in stack when translate code strings
authorChristophe Simonis <christophe@tinyerp.com>
Thu, 13 Aug 2009 11:06:43 +0000 (13:06 +0200)
committerChristophe Simonis <christophe@tinyerp.com>
Thu, 13 Aug 2009 11:06:43 +0000 (13:06 +0200)
bzr revid: christophe@tinyerp.com-20090813110643-9y2wgb6omp6odjsz

bin/tools/translate.py

index 2e46f6e..736afdf 100644 (file)
@@ -125,7 +125,11 @@ def translate(cr, name, source_type, lang, source=None):
 
 class GettextAlias(object):
     def __call__(self, source):
-        frame = inspect.stack()[1][0]
+        try:
+            frame = inspect.stack()[1][0]
+        except:
+            return source
+
         cr = frame.f_locals.get('cr')
         lang = (frame.f_locals.get('context') or {}).get('lang', False)
         if not (lang and cr):