Skip to content

Commit

Permalink
fix: use alternative ICAT mapping for Instrument pid when pid is None #…
Browse files Browse the repository at this point in the history
  • Loading branch information
VKTB committed Feb 10, 2022
1 parent 3385282 commit ae7e57a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datagateway_api/src/search_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ class Instrument(PaNOSCAttribute):

datasets: Optional[List[Dataset]] = []

@validator("pid", pre=True, always=True)
def set_pid(cls, value): # noqa: B902, N805
return f"pid:{value}" if isinstance(value, int) else value

@classmethod
def from_icat(cls, icat_data, required_related_fields):
return super(Instrument, cls).from_icat(icat_data, required_related_fields)
Expand Down

0 comments on commit ae7e57a

Please sign in to comment.