jenkins-bot has submitted this change and it was merged.

Change subject: Load project from config for unused images/images without id
......................................................................


Load project from config for unused images/images without id

Project falls back to wikipedia if none is given.
Also corrects page name on ru.wikivoyage

Bug: T131344
Change-Id: Idea12824081380055ca5e7a390397420bd51a703
---
M erfgoedbot/images_of_monuments_without_id.py
M erfgoedbot/monuments_config.py
M erfgoedbot/unused_monument_images.py
3 files changed, 11 insertions(+), 10 deletions(-)

Approvals:
  Jean-Frédéric: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/erfgoedbot/images_of_monuments_without_id.py 
b/erfgoedbot/images_of_monuments_without_id.py
index 625415c..84e1dee 100644
--- a/erfgoedbot/images_of_monuments_without_id.py
+++ b/erfgoedbot/images_of_monuments_without_id.py
@@ -13,12 +13,10 @@
 
 
 '''
-import sys
 import monuments_config as mconfig
 import wikipedia
 import config
 import MySQLdb
-import time
 ##import re, imagerecat, pagegenerators, catlib
 
 
@@ -55,6 +53,7 @@
 
     commonsTemplate = countryconfig.get('commonsTemplate')
     imagesWithoutIdPage = countryconfig.get('imagesWithoutIdPage')
+    project = countryconfig.get('project', u'wikipedia')
 
     # All items in the list with a photo
     withPhoto = getMonumentsWithPhoto(
@@ -108,8 +107,7 @@
     if imagesWithoutIdPage:
         comment = u'Images without an id'
 
-        site = wikipedia.getSite(lang, u'wikipedia')
-
+        site = wikipedia.getSite(lang, project)
         page = wikipedia.Page(site, imagesWithoutIdPage)
         wikipedia.output(text)
         page.put(text, comment)
@@ -217,8 +215,9 @@
     (conn2, cursor2) = connectDatabase2()
 
     for arg in wikipedia.handleArgs():
-        if arg.startswith('-countrycode:'):
-            countrycode = arg[len('-countrycode:'):]
+        option, sep, value = arg.partition(':')
+        if option == '-countrycode':
+            countrycode = value
 
     if countrycode:
         # looks like default lang is 'nl'
diff --git a/erfgoedbot/monuments_config.py b/erfgoedbot/monuments_config.py
index f99f0a9..bf2dbc2 100755
--- a/erfgoedbot/monuments_config.py
+++ b/erfgoedbot/monuments_config.py
@@ -6846,7 +6846,7 @@
         'commonsCategoryBase' : u'Cultural heritage monuments in Russia',
         'autoGeocode' : False,
         'unusedImagesPage' : u'Культурное наследие России/Неиспользуемые 
изображения',
-        'imagesWithoutIdPage' : u'Культурное наследие России/Проблемные 
изображения',
+        'imagesWithoutIdPage' : u'Культурное наследие России/Изображения без 
ID',
         'registrantUrlBase' : 
u'http://kulturnoe-nasledie.ru/monuments.php?id=%s',
         'namespaces' : [0],
         'table' : u'monuments_ru_(ru)',
diff --git a/erfgoedbot/unused_monument_images.py 
b/erfgoedbot/unused_monument_images.py
index ee73147..8be1f3e 100644
--- a/erfgoedbot/unused_monument_images.py
+++ b/erfgoedbot/unused_monument_images.py
@@ -48,6 +48,7 @@
         return False
 
     unusedImagesPage = countryconfig.get('unusedImagesPage')
+    project = countryconfig.get('project', u'wikipedia')
     commonsTrackerCategory = countryconfig.get(
         'commonsTrackerCategory'). replace(u' ', u'_')
 
@@ -117,7 +118,7 @@
 
     # text = text + getInterwikisUnusedImages(countrycode, lang)
 
-    site = pywikibot.Site(lang, u'wikipedia')
+    site = pywikibot.Site(lang, project)
     page = pywikibot.Page(site, unusedImagesPage)
     pywikibot.output(text)
     page.put(text, comment)
@@ -215,8 +216,9 @@
     (conn2, cursor2) = connectDatabase2()
 
     for arg in pywikibot.handleArgs():
-        if arg.startswith('-countrycode:'):
-            countrycode = arg[len('-countrycode:'):]
+        option, sep, value = arg.partition(':')
+        if option == '-countrycode':
+            countrycode = value
 
     if countrycode:
         lang = pywikibot.Site().language()

-- 
To view, visit https://gerrit.wikimedia.org/r/280903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idea12824081380055ca5e7a390397420bd51a703
Gerrit-PatchSet: 4
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>
Gerrit-Reviewer: Jean-Frédéric <[email protected]>
Gerrit-Reviewer: Lokal Profil <[email protected]>
Gerrit-Reviewer: Multichill <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to