django-daiquiri / daiquiri

A framework for the publication of scientific databases
https://escience.aip.de/daiquiri
Apache License 2.0
26 stars 8 forks source link

BUG: VOTable generator is broken #127

Closed agy-why closed 1 year ago

agy-why commented 1 year ago

I obtain a weird error from a user trying to download his job in VOTABLE format. The generation of the VOTable fails because the key 'ucd' does not exitst, although the table was generated by daiquiri.

It starts here: https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/query/tasks.py#L280 And fails here: https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/core/generators.py#L96 with KeyError 'ucd' on field['ucd']

It is puzzling why field does not have the key 'ucd' although it comes from the metadata.

agy-why commented 1 year ago

it seems that there is no guarranty on the content of field. The default is {}. Therefore we need to check for the existence of the ucd key.

ucds = field.get('ucd', '')
if "meta.id" in ucds and "meta.ref" in ucds:
...