From 477f158172fbb257f11d5da8a2002193f0a3e735 Mon Sep 17 00:00:00 2001 From: notconfusing Date: Sun, 19 Feb 2017 22:43:29 +0000 Subject: [PATCH] tentative fix for double-image-page uploading #63 #62 --- journal_article.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/journal_article.py b/journal_article.py index 83b8a0b..4f8b9bb 100644 --- a/journal_article.py +++ b/journal_article.py @@ -221,17 +221,17 @@ def upload(site, metadata, image_dict_selector): if image_file: #we found a valid image file logger.info("Attempting upload of %s" % image_file) harmonized_name = helpers.harmonizing_name(image_file, metadata['article-title']) - image_page = mwclient.page.Page(site, harmonized_name) + # image_page = mwclient.page.Page(site, harmonized_name) # try not uploading a separate image page page_text = commons_template.page(metadata, metadata[image_dict_selector][image]['caption']) #need this triple indexing because caption isn't anywhere else #TODO - image_page._text = page_text + # image_page._text = page_text # try not uploading a separate image page try: site.upload(open(qualified_image_location, 'rb'), harmonized_name, - 'Automatic upload of media from: [[doi:' + self.doi+']]', + 'Automatic upload of media from: [[doi:%s]]\n%s' % (self.doi, page_text) ) logger.info('Uploaded image %s' % image_file) metadata[image_dict_selector][image]['uploaded_name'] = harmonized_name #TODO less long-winded indexing - image_page.save(text = page_text, bot = True) + # image_page.save(text = page_text, bot = True) # try not uploading a separate image page except: logger.info('Error uploading image %s' % image_file)