Commit 59301c4c authored by Guillaume Mella's avatar Guillaume Mella
Browse files

ID2 can now be empty

parent d92f49f7
......@@ -67,7 +67,7 @@ class StarInfo(Base):
'mode_id': F_DUMP,
'fields': {
'ID1': { 'field': 'id1', 'must': True, 'check': 'check_star' },
'ID2': { 'field': 'id2', 'must': True, 'check': 'check_star' },
'ID2': { 'field': 'id2', 'must': True, 'check': 'check_star2' },
'UD_DIAM': { 'field': 'ud_diam', 'must': True, 'check': 'check_float', 'alternate': 'UD_MEAS' },
'UD_MEAS': { 'field': 'ud_diam', 'check': 'check_float' },
'LD_DIAM': { 'field': 'ld_diam', 'must': True, 'check': 'check_float', 'alternate': 'LD_MEAS' },
......@@ -257,10 +257,11 @@ class StarInfo(Base):
# print("setting value '%s' to object variable '%s'"%(str(value), field_name))
setattr(self, field_name, value)
def check_star(self, field_name, field_info, value):
def check_star(self, field_name, field_info, value, accept_empty_value=False):
# print("Checking star '%s' for field '%s'"%(value, field_name))
if not value:
self.append_error(field_name, 'star identifier not set')
if not accept_empty_value :
self.append_error(field_name, 'star identifier not set')
star = self.query_starname(value)
......@@ -273,6 +274,10 @@ class StarInfo(Base):
self.set_field_value(field_var, value)
def check_star2(self, field_name, field_info, value):
self.check_star(field_name, field_info, value, True)
def check_float(self, field_name, field_info, value):
if isinstance(value, str):
if not value:
Supports Markdown
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