Skip to content

Commit

Permalink
fix: use alternative ICAT mapping for Dataset pid when doi is None #314
Browse files Browse the repository at this point in the history
  • Loading branch information
VKTB committed Feb 10, 2022
1 parent 6206e9c commit b813f3d
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 @@ -191,6 +191,10 @@ class Dataset(PaNOSCAttribute):
parameters: Optional[List["Parameter"]] = []
samples: Optional[List["Sample"]] = []

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

@validator("is_public", pre=True, always=True)
def set_is_public(cls, value): # noqa: B902, N805
if not value:
Expand Down

0 comments on commit b813f3d

Please sign in to comment.