Skip to content

Commit

Permalink
fix: use alternative ICAT mapping for Document 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 341ee51 commit 736c6bd
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 @@ -236,6 +236,10 @@ class Document(PaNOSCAttribute):
members: Optional[List["Member"]] = []
parameters: Optional[List["Parameter"]] = []

@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 736c6bd

Please sign in to comment.