Skip to content

Commit

Permalink
bugfix - made signature compatible with the parent class and by repla…
Browse files Browse the repository at this point in the history
…cing record with topic and changed the function body accordingly
  • Loading branch information
edager committed Nov 25, 2024
1 parent 10c679f commit 30728f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions oarepo_doi/types/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def can_create(self, identity, data, receiver, topic, creator, *args, **kwargs):
)
super().can_create(identity, data, receiver, topic, creator, *args, **kwargs)

def is_applicable_to(self, identity, record , *args, **kwargs):
def is_applicable_to(self, identity, topic, *args, **kwargs):
mapping_file = current_app.config.get("DATACITE_MAPPING")
mapping = obj_or_import_string(mapping_file[record.schema])()
doi_value = mapping.get_doi(record) #if ANY doi already assigned, adding another is not possible
mapping = obj_or_import_string(mapping_file[topic.schema])()
doi_value = mapping.get_doi(topic) #if ANY doi already assigned, adding another is not possible
if doi_value:
return False
else:
return super().is_applicable_to(identity, record, *args, **kwargs)
return super().is_applicable_to(identity, topic, *args, **kwargs)

@override
def stateful_name(self, identity, *, topic, request=None, **kwargs):
Expand Down

0 comments on commit 30728f8

Please sign in to comment.