[damned-lies] Don't crash when calcstats does not return data



commit 202b38e3e3dbaed2bc2be8aa8661b316b2a02575
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Dec 18 16:54:53 2013 +0100

    Don't crash when calcstats does not return data

 stats/utils.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/stats/utils.py b/stats/utils.py
index 2e7bee8..631f211 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -335,9 +335,10 @@ def po_file_stats(pofile, msgfmt_checks=True):
 
         if has_toolkit:
             status = pocount.calcstats_old(pofile)
-            res['fuzzy_words'] = status['fuzzysourcewords']
-            res['translated_words'] = status['translatedsourcewords']
-            res['untranslated_words'] = status['untranslatedsourcewords']
+            if status:
+                res['fuzzy_words'] = status['fuzzysourcewords']
+                res['translated_words'] = status['translatedsourcewords']
+                res['untranslated_words'] = status['untranslatedsourcewords']
 
     elif isinstance(pofile, File):
         filename = pofile.name


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]