[cwconfig] shutup on absent i18n/ mo files when in operating in tests
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 07 Jun 2012 18:33:53 +0200
changeset 8436 150191e45ee5
parent 8435 5064b6e0d6f4
child 8437 c9ab72f0645d
[cwconfig] shutup on absent i18n/ mo files when in operating in tests
cwconfig.py
--- a/cwconfig.py	Thu Jun 07 18:24:37 2012 +0200
+++ b/cwconfig.py	Thu Jun 07 18:33:53 2012 +0200
@@ -1152,8 +1152,11 @@
                 tr = translation('cubicweb', path, languages=[language])
                 self.translations[language] = (tr.ugettext, tr.upgettext)
             except (ImportError, AttributeError, IOError):
-                self.exception('localisation support error for language %s',
-                               language)
+                if self.mode != 'test':
+                    # in test contexts, data/i18n does not exist, hence
+                    # logging will only pollute the logs
+                    self.exception('localisation support error for language %s',
+                                   language)
 
     def vregistry_path(self):
         """return a list of files or directories where the registry will look