Skip to content

Commit

Permalink
File serializer should not error w/o guid
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Feb 5, 2024
1 parent 060f08e commit 1a34604
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions api/files/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
ShowIfVersion,
)
from api.base.utils import absolute_reverse, get_user_auth
from api.base.exceptions import Conflict, JSONAPIException
from api.base.exceptions import Conflict
from api.base.versioning import get_kebab_snake_case_field

class CheckoutField(ser.HyperlinkedRelatedField):
Expand Down Expand Up @@ -370,13 +370,6 @@ def get_file_guid(self, obj):
return guid._id
return None

def get_file_guid_or_error(self, obj):
if obj:
guid = obj.get_guid()
if guid:
return guid._id
raise JSONAPIException

def get_absolute_url(self, obj):
return api_v2_url('files/{}/'.format(obj._id))

Expand All @@ -402,7 +395,7 @@ class FileSerializer(BaseFileSerializer):

cedar_metadata_records = RelationshipField(
related_view='files:file-cedar-metadata-records-list',
related_view_kwargs={'file_guid': 'get_file_guid_or_error'},
related_view_kwargs={'file_guid': 'get_file_guid'},
)

def get_target_type(self, obj):
Expand Down

0 comments on commit 1a34604

Please sign in to comment.