jenkins-bot has submitted this change and it was merged.
Change subject: core-specific changes
......................................................................
core-specific changes
- use site.code instead of site.lang for L10N
- use Page.title(asUrl=True) instead of Page.urlname()
- update documentation
Change-Id: I05a705934ba23d41b337997ae004bb14c614a12d
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 11 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index e361c38..d79d3ac 100644
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -335,7 +335,7 @@
'it': u':{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Senza
licenza2|%s|__botnick__}} --~~~~',
}
-# You can add some settings to wikipedia. In this way, you can change them
+# You can add some settings to a wiki page. In this way, you can change them
# without touching the code. That's useful if you are running the bot on
# Toolserver.
page_with_settings = {
@@ -613,7 +613,7 @@
self.project = project
bot = config.usernames[project]
try:
- botnick = bot[self.site.lang]
+ botnick = bot[self.site.code]
except KeyError:
raise pywikibot.NoUsername(
u"You have to specify an username for your bot in this project
"
@@ -763,8 +763,6 @@
second_text = False
# Getting the talk page's history, to check if there is another
# advise...
- # The try block is used to prevent error if you use an old
- # wikipedia.py's version.
try:
testoattuale = self.talk_page.get()
history = self.talk_page.getLatestEditors(limit=10)
@@ -888,7 +886,6 @@
def returnOlderTime(self, listGiven, timeListGiven):
""" Get some time and return the oldest of them
"""
- usage = False
num = 0
num_older = None
max_usage = 0
@@ -981,7 +978,7 @@
# project.
return
if re.findall(r'\bstemma\b', self.imageName.lower()) and \
- self.site.lang == 'it':
+ self.site.code == 'it':
pywikibot.output(
u'%s has "stemma" inside, means that it\'s
ok.'
% self.imageName)
@@ -1034,7 +1031,7 @@
for duplicate in duplicates:
DupePage = pywikibot.ImagePage(self.site, duplicate)
- if DupePage.urlname() != self.image.urlname() or \
+ if DupePage.title(asUrl=True) != self.image.title(asUrl=True) or \
self.timestamp is None:
self.timestamp = DupePage.getLatestUploader()[1]
data = time.strptime(self.timestamp,
u"%Y-%m-%dT%H:%M:%SZ")
@@ -1115,7 +1112,6 @@
if len(images_to_tag_list) != 0 and not only_report:
already_reported_in_past = self.countEdits(
u'File:%s' % images_to_tag_list[-1], self.botolist)
- image_to_resub = images_to_tag_list[-1]
from_regex = r'\n\*\[\[:File:%s\]\]' \
% re.escape(self.convert_to_url(
self.imageName))
@@ -1299,7 +1295,7 @@
pywikibot.output(u'\nLoading the allowed licenses...\n')
cat = pywikibot.Category(self.site, catName)
list_licenses = list(cat.articles())
- if self.site.lang == 'commons':
+ if self.site.code == 'commons':
no_licenses_to_skip = pywikibot.Category(self.site,
'License-related tags')
for license_given in no_licenses_to_skip.articles():
@@ -1488,7 +1484,6 @@
def load(self, raw):
""" Load a list of objects from a string using regex.
"""
list_loaded = []
- pos = 0
# I search with a regex how many user have not the talk page
# and i put them in a list (i find it more easy and secure)
regl = r"(\"|\')(.*?)\1(?:,|\])"
@@ -1898,7 +1893,7 @@
# A little block-statement to ensure that the bot will not start with
# en-parameters
- if site.lang not in project_inserted:
+ if site.code not in project_inserted:
pywikibot.output(u"Your project is not supported by this script.\n"
u"You have to edit the script and add it!")
return
--
To view, visit
https://gerrit.wikimedia.org/r/142877
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I05a705934ba23d41b337997ae004bb14c614a12d
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>