Skip to content
Snippets Groups Projects
Commit 7e58e546 authored by Branson Stephens's avatar Branson Stephens
Browse files

checking for empty file name in log model save method

parent 2f4e2bb8
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment