@@ -474,18 +474,31 @@ def _save_articles(self, dest_dir, article_list, dest_service, zip_articles):
474
474
# error description if there is an error.
475
475
saved_files = []
476
476
for article in article_list :
477
+ # Prep a message in case we must report a problem.
478
+ if article .doi :
479
+ identifier = ' ' + article .doi
480
+ elif article .date :
481
+ identifier = ' from ' + article .date
482
+ if article .title :
483
+ identifier += ' with title "' + article .title + '"'
484
+ elif article .title :
485
+ identifier = ' with title "' + article .title + '"'
486
+ else :
487
+ identifier = ''
488
+ skipping_preface = 'Skipping article' + identifier + ' because of '
489
+
477
490
# Start by testing that we have all the data we will need.
478
491
if not article .doi :
479
- warn ('Skipping article with missing DOI: ' + article . title )
492
+ warn (skipping_preface + ' missing DOI' )
480
493
article .status = 'missing-doi'
481
494
continue
482
495
if not article .pdf :
483
- warn ('Skipping article with missing PDF URL: ' + article . doi )
496
+ warn (skipping_preface + ' missing PDF URL' )
484
497
article .status = 'missing-pdf'
485
498
continue
486
499
if self .journal .uses_jats and not article .jats :
487
500
# We need JATS for PMC.
488
- warn ('Skipping article with missing JATS URL: ' + article . doi )
501
+ warn (skipping_preface + ' missing JATS URL' )
489
502
article .status = 'missing-jats'
490
503
continue
491
504
xmldict = self .journal .article_metadata (article )
@@ -543,7 +556,7 @@ def _save_article_portico(self, dest_dir, article, xmldict):
543
556
if not download_file (article .jats , jats_file ):
544
557
warn (f'Could not download JATS file for { article .doi } ' )
545
558
article .status = 'failed-jats-download'
546
- if self .do_validate :
559
+ if self .do_validate and article . status != 'failed-jats-download' :
547
560
if not valid_xml (jats_file , self ._dtd ):
548
561
warn (f'Failed to validate JATS for article { article .doi } ' )
549
562
article .status = 'failed-jats-validation'
0 commit comments