Commit 7ec60b03 authored by Leo P. Singer's avatar Leo P. Singer
Browse files

Fix bug in parsing of SnglInspiral tables with omitted columns

The bug was due to the incorrect assumption about the default value
of nullable Django fields (`Field(null=True)`). The assumption was
that `field.default` is `None`, but in fact `field.default` has the
sentinel value of `NOT_PROVIDED`.
parent f7162ff9
Pipeline #119045 passed with stages
in 20 minutes and 43 seconds
......@@ -2,6 +2,7 @@ from math import isnan
import numbers
from django.db import models, IntegrityError
from django.db.models import NOT_PROVIDED
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.utils import six
......@@ -794,7 +795,7 @@ class SingleInspiral(models.Model):
e = cls(event=event)
#log.debug("Single/creating event")
for f in [cls._meta.get_field(f) for f in cls.field_names()]:
value = getattr(row, f.attname, f.default)
value = getattr(row, f.attname, None if f.default is NOT_PROVIDED else f.default)
# Awful kludge for handling nan for eff_distance
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment