From 7e58e54656340981cbb2f741ecd6e1db793d70db Mon Sep 17 00:00:00 2001
From: Branson Stephens <stephenb@uwm.edu>
Date: Tue, 25 Jun 2013 11:55:34 -0500
Subject: [PATCH] checking for empty file name in log model save method

---
 gracedb/models.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gracedb/models.py b/gracedb/models.py
index 52d3e6a87..35b6c2472 100644
--- a/gracedb/models.py
+++ b/gracedb/models.py
@@ -228,6 +228,9 @@ class EventLog(models.Model):
 
     def save(self, *args, **kwargs):
         success = False
+        # XXX filename must not be 'None' because null=False for the filename
+        # field above.
+        self.filename = self.filename or ""
         attempts = 0
         while (not success and attempts < 5):
             attempts = attempts + 1
@@ -238,7 +241,7 @@ class EventLog(models.Model):
             try:
                 super(EventLog, self).save(*args, **kwargs)
                 success = True
-            except IntegrityError:
+            except IntegrityError as e:
                 # IntegrityError means an attempt to insert a duplicate
                 # key or to violate a foreignkey constraint.
                 # We are under race conditions.  Let's try again.
-- 
GitLab