[damned-lies] Fixed an optional attribute access



commit ffbfea842adcb857bfb304bbcb256d06977cb910
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Dec 15 20:31:15 2012 +0100

    Fixed an optional attribute access

 stats/models.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 1605d05..2e1bad7 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1681,7 +1681,7 @@ class Statistics(models.Model):
             if categ_key not in stats['categs']:
                 stats['categs'][categ_key] = {
                     'cattrans': 0, 'catfuzzy': 0, 'catuntrans': 0, 'cattransperc': 0,
-                    'catname': _(category_choices_dict[stat.categ_name]),
+                    'catname': _(category_choices_dict[getattr(stat, 'categ_name', 'default')]),
                     'modules': {}
                 }
             # Try to get translated stat, else stick with POT stat



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