From 21faa6b9dbf3c2db3f7d6c0a1c9db0c93f312d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 20 Oct 2013 00:15:17 +0200 Subject: [PATCH] Don't export empty translation file --- trytond/ir/translation.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 699ef34aff..3f13f68554 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -956,8 +956,11 @@ class Translation(ModelSQL, ModelView): flags=flags) pofile.append(entry) - pofile.sort() - return unicode(pofile).encode('utf-8') + if pofile: + pofile.sort() + return unicode(pofile).encode('utf-8') + else: + return class TranslationSetStart(ModelView): @@ -1609,7 +1612,7 @@ class TranslationExport(Wizard): Translation = pool.get('ir.translation') file_data = Translation.translation_export( self.start.language.code, self.start.module.name) - self.result.file = buffer(file_data) + self.result.file = buffer(file_data) if file_data else None return 'result' def default_result(self, fields):