Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions article/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,12 +772,10 @@ def check_availability(self, user, force_update=False):
if not force_update and self.is_available():
return True

event = None
urls = []
for item in self.article_availability.all():
urls.append(item.url)

event = self.add_event(user, _("register urls"))
for item in self.urls_data:
if item["url"] in urls:
urls.remove(item["url"])
Expand All @@ -794,17 +792,15 @@ def check_availability(self, user, force_update=False):
return self.mark_as_available()
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
if event:
event.finish(completed=False, exceptions=traceback.format_exc())
else:
UnexpectedEvent.create(
item=str(self),
exception=e,
exc_traceback=exc_traceback,
detail=dict(
function="article.models.Article.check_availability",
),
)
UnexpectedEvent.create(
action="article.models.Article.check_availability",
item=str(self),
exception=e,
exc_traceback=exc_traceback,
detail={
"traceback": traceback.format_exc()
},
)

def mark_as_available(self):
save = False
Expand Down
12 changes: 5 additions & 7 deletions article/sources/preprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def harvest_preprints(URL, user):
# Clear existing contrib_persons to avoid duplication on reharvest
article.contrib_persons.all().delete()
get_or_create_contrib_persons(
article=article,
user=user,
authors=article_info.get("authors")
article=article, user=user, authors=article_info.get("authors")
)
article.keywords.set(
get_or_create_keyword(keywords=article_info.get("subject"), user=user)
Expand Down Expand Up @@ -262,10 +260,10 @@ def set_dates(article, date):
def get_or_create_contrib_persons(article, user, authors):
"""
Create or update ContribPerson objects for preprint authors.
Note: In preprint processing, only basic name fields (given_names, surname,
declared_name) are currently extracted from the OAI-DC format. Affiliation
data is not available in the preprint metadata structure, so affiliation

Note: In preprint processing, only basic name fields (given_names, surname,
declared_name) are currently extracted from the OAI-DC format. Affiliation
data is not available in the preprint metadata structure, so affiliation
is set to None.
"""
data = []
Expand Down
Loading
Loading