Skip to content

Commit

Permalink
Merge pull request #455 from CDLUC3/feature-crossref-emails
Browse files Browse the repository at this point in the history
Fix issues with not being able to send error emails to Crossref owners
  • Loading branch information
rushirajnenuji authored Aug 8, 2023
2 parents 931f673 + 21673f4 commit d8ffb98
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ templates/info/
*\.egg-info/
\.pytest_cache/
.eggs/
pytest.ini
.test-venv
5 changes: 4 additions & 1 deletion ezidapp/management/commands/proc-crossref.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Command(ezidapp.management.commands.proc_base.AsyncProcessingCommand):
name = __name__
setting = 'DAEMONS_CROSSREF_ENABLED'
queue = ezidapp.models.async_queue.CrossrefQueue
refIdentifier = ezidapp.models.identifier.RefIdentifier

def run(self):
"""Run async processing loop forever.
Expand Down Expand Up @@ -307,6 +308,7 @@ def check_status(self, task_model: ezidapp.models.async_queue.CrossrefQueue):
else:
task_model.status = self.queue.FAILURE
id_status = ezidapp.models.identifier.Identifier.CR_FAILURE
msg_str = self._oneLine(t[1]).strip()

task_model.message = msg_str

Expand All @@ -324,7 +326,8 @@ def check_status(self, task_model: ezidapp.models.async_queue.CrossrefQueue):
assert s.startswith('success:'), f'ezid.setMetadata failed: {s}'

if task_model.status in (self.queue.WARNING, self.queue.FAILURE):
u = ezidapp.models.util.getUserByPid(task_model.owner)
refOwner = ref_id.owner_id
u = ezidapp.models.util.getUserById(refOwner)
if u.crossrefEmail:
self._sendEmail(u.crossrefEmail, task_model)

Expand Down
3 changes: 2 additions & 1 deletion ezidapp/models/identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def __str__(self):
f'isDOI={self.isDoi}, '
f'isDataCite={self.isDatacite}, '
f'isCrossref={self.isCrossref}, '
f'target={self.target}'
f'target={self.target}, '
f'ownerId={self.owner_id}'
f')'
)

Expand Down

0 comments on commit d8ffb98

Please sign in to comment.