[damned-lies] Prevent crash in Branch.__eq__



commit 9812dc7e3a7ed76d3b6f4bbcc326a81a8aeb6243
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Aug 25 18:56:18 2015 +0200

    Prevent crash in Branch.__eq__

 stats/models.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 15ec3d6..0fca5a8 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -246,6 +246,8 @@ class Branch(models.Model):
         super(Branch, self).delete()
 
     def __eq__(self, other):
+        if not isinstance(other, self.__class__):
+            return False
         return (self.module.name, self.name) == (other.module.name, other.name)
 
     def __lt__(self, other):
@@ -1131,7 +1133,7 @@ class Release(models.Model):
         po_stats = dict([("%s-%s" % (st.branch_id, st.domain_id), st)
                          for st in Statistics.objects.filter(language=lang, branch__releases=self, 
domain__dtype=dtype)])
         lang_files = []
-        last_modif_date = datetime(1970, 01, 01)
+        last_modif_date = datetime(1970, 1, 1)
         # Create list of files
         for stat in pot_stats:
             if stat.full_po.updated > last_modif_date:


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