Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/203659
Change subject: [IMPROV] Don't use deprecated methods in checkimages
......................................................................
[IMPROV] Don't use deprecated methods in checkimages
* use User class for talk page and title
* use exists() and isRedirectPage() instead of try/except construct
Change-Id: I26bfbdf403d93b504ac32e7924e3a5dd946ed4e0
---
M scripts/checkimages.py
1 file changed, 10 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/59/203659/1
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index a477953..f724772 100644
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -754,15 +754,15 @@
repme)
return
upBots = i18n.translate(self.site, uploadBots)
- luser = pywikibot.url2link(nick, self.site, self.site)
+ user = pywikibot.User(self.site, nick)
+ luser = user.title(asUrl=True)
if upBots:
for upBot in upBots:
if upBot[0] == luser:
luser = self.uploadBotChangeFunction(reportPageText, upBot)
- talk_page = pywikibot.Page(self.site,
- u"%s:%s" % (self.site.namespace(3), luser))
- self.talk_page = talk_page
+ user = pywikibot.User(self.site, luser)
+ self.talk_page = user.getUserTalkPage()
self.luser = luser
return True
@@ -1290,15 +1290,13 @@
break
if not self.license_found:
for template in self.licenses_found:
- try:
- template.pageAPInfo()
- except pywikibot.IsRedirectPage:
+ if not template.exists():
+ continue
+ if template.isRedirectPage():
template = template.getRedirectTarget()
result = self.miniTemplateCheck(template)
if result:
break
- except pywikibot.NoPage:
- continue
def smartDetection(self):
"""
@@ -1357,12 +1355,10 @@
iterlist = list(self.allLicenses)
for template in iterlist:
- try:
- template.pageAPInfo()
- except pywikibot.IsRedirectPage:
- template = template.getRedirectTarget()
- except pywikibot.NoPage:
+ if not template.exists():
self.allLicenses.remove(template)
+ elif template.isRedirectPage():
+ template = template.getRedirectTarget()
if self.allLicenses:
self.license_found = self.allLicenses[0].title()
--
To view, visit https://gerrit.wikimedia.org/r/203659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I26bfbdf403d93b504ac32e7924e3a5dd946ed4e0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits