Skip to content
Snippets Groups Projects
Commit 27b5d328 authored by Branson Craig Stephens's avatar Branson Craig Stephens
Browse files

Fixed two small bugs associated with the single inspiral tables.

parent 91be6c3b
No related branches found
No related tags found
No related merge requests found
...@@ -751,7 +751,11 @@ class SingleInspiral(models.Model): ...@@ -751,7 +751,11 @@ class SingleInspiral(models.Model):
e = cls(event=event) e = cls(event=event)
#log.debug("Single/creating event") #log.debug("Single/creating event")
for column in field_names: for column in field_names:
value = getattr(row, column) try:
value = getattr(row, column)
except:
# We don't want to fail if the value is not present.
value = None
#log.debug("Setting column '%s' with value '%s'" % (column, value)) #log.debug("Setting column '%s' with value '%s'" % (column, value))
setattr(e, column, value) setattr(e, column, value)
e.save() e.save()
......
...@@ -19,8 +19,6 @@ from utils.vfile import VersionedFile ...@@ -19,8 +19,6 @@ from utils.vfile import VersionedFile
import json import json
import logging
use_in(LIGOLWContentHandler) use_in(LIGOLWContentHandler)
# This function checks for 'inf' in a float field, asks the database # This function checks for 'inf' in a float field, asks the database
...@@ -166,6 +164,9 @@ def handle_uploaded_data(event, datafilename, ...@@ -166,6 +164,9 @@ def handle_uploaded_data(event, datafilename,
# Extract Single Inspiral Information # Extract Single Inspiral Information
s_inspiral_table = SnglInspiralTable.get_table(xmldoc) s_inspiral_table = SnglInspiralTable.get_table(xmldoc)
# If this is a replacement, we might already have single inspiral tables
# associated. So we should re-create them.
event.singleinspiral_set.all().delete()
SingleInspiral.create_events_from_ligolw_table(s_inspiral_table, event) SingleInspiral.create_events_from_ligolw_table(s_inspiral_table, event)
elif pipeline == 'HardwareInjection': elif pipeline == 'HardwareInjection':
......
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