Skip to content

Commit

Permalink
Merge pull request #854 from gitnnolabs/fix_metadata_aoi
Browse files Browse the repository at this point in the history
Adiciona um novo tratamento de excessão para a geração do source para o artigo.
  • Loading branch information
gitnnolabs authored Sep 2, 2024
2 parents 41a0cf7 + ba13c6c commit 64a22b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions article/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import logging
from datetime import datetime

from django.core.files.base import ContentFile
Expand Down Expand Up @@ -217,15 +218,19 @@ def source(self):
"""
leg_dict = {
"title": self.journal.title if self.journal else "",
"pubdate": str(self.pub_date_year),
"pubdate": str(self.pub_date_year) if self.pub_date_year else "",
"volume": self.issue.volume if self.issue else "",
"number": self.issue.number if self.issue else "",
"fpage": self.first_page,
"lpage": self.last_page,
"elocation": self.elocation_id,
}

return descriptive_format(**leg_dict)
try:
return descriptive_format(**leg_dict)
except Exception as ex:
logging.exception("Erro on article %s, error: %s" % (self.pid_v2, ex))
return ""

@classmethod
def get_or_create(cls, doi, pid_v2, fundings, user):
Expand Down

0 comments on commit 64a22b5

Please sign in to comment.