Skip to content

Commit

Permalink
Merge pull request #6 from edager/main
Browse files Browse the repository at this point in the history
bugfix TypeError when is_applicable_to was called
  • Loading branch information
mesemus authored Nov 27, 2024
2 parents 10c679f + b03a228 commit 2255ee0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
Expand Down
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 2255ee0

Please sign in to comment.