Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #2024
Status: Errored
Duration: 41 minutes and 34 seconds
Commit: cc07dfb (master)
Author: Fabian Neundorf
Message: [FIX] Ignore invalid titles
Previously it ignored invalid template titles like parser functions but
not when the error occured in the constructor.
Change-Id: Ibcb011848821fa2392965709771cee7737e67a95
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/d1358e05d743...cc07dfbe…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/52311729
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Replace getImagePageHtml() with fileIsShared()
......................................................................
Replace getImagePageHtml() with fileIsShared()
ImagePage.getImagePageHtml() was used in the original 2007 checkimages
script to detect if a local page exists for the same name as a file on
the shared repository. ImagePage now has a cheaper method fileIsShared()
which achieves the same goal.
Likewise getImagePageHtml() was used in the original 2007 unusedfiles
script to detect if the rendered page contained:
<table id="mw_metadata" class="mw_metadata">
which indicated that it had an image linked to it. Using fileUrl()
and fileIsShared() achieves the same goal.
Change-Id: I5fd3f34b9081fdbb20b853052fe1c4c30e360d93
---
M scripts/checkimages.py
M scripts/unusedfiles.py
2 files changed, 5 insertions(+), 11 deletions(-)
Approvals:
Ladsgroup: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 5c63a33..41b0aac 100644
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -912,9 +912,7 @@
return True # continue with the check-part
pywikibot.output(u'%s is on commons!' % self.imageName)
- on_commons_text = self.image.getImagePageHtml()
- if re.search(r"\<div class\=(?:'|\")sharedUploadNotice(?:'|\")\>",
- on_commons_text):
+ if self.image.fileIsShared():
pywikibot.output(
u"But, the file doesn't exist on your project! Skip...")
# We have to skip the check part for that image because
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index a4c7fd9..7307368 100644
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -42,10 +42,6 @@
'fa': u'\n\n{{جا:اخطار به کاربر برای تصاویر بدون استفاده|%(title)s}}--~~~~',
'it': u'\n\n{{Utente:Filbot/Immagine orfana}}',
}
-except_text = {
- 'en': u'<table id="mw_metadata" class="mw_metadata">',
- 'it': u'<table id="mw_metadata" class="mw_metadata">',
-}
class UnusedFilesBot(Bot):
@@ -63,9 +59,8 @@
template_to_the_image)
template_user = i18n.translate(self.site,
template_to_the_user)
- except_text_translated = i18n.translate(self.site, except_text)
summary = i18n.translate(self.site, comment, fallback=True)
- if not all([template_image, template_user, except_text_translated, comment]):
+ if not all([template_image, template_user, comment]):
raise pywikibot.Error(u'This script is not localized for %s site.'
% self.site)
self.summary = summary
@@ -76,8 +71,9 @@
pywikibot.output(u"File '%s' does not exist (see bug 69133)."
% image.title())
continue
- if (except_text_translated.encode('utf-8')
- not in image.getImagePageHtml() and
+ # Use fileUrl() and fileIsShared() to confirm it is local media
+ # rather than a local page with the same name as shared media.
+ if (image.fileUrl() and not image.fileIsShared() and
u'http://' not in image.text):
if template_image in image.text:
pywikibot.output(u"%s done already"
--
To view, visit https://gerrit.wikimedia.org/r/153293
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5fd3f34b9081fdbb20b853052fe1c4c30e360d93
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Ignore invalid titles
......................................................................
[FIX] Ignore invalid titles
Previously it ignored invalid template titles like parser functions but
not when the error occured in the constructor.
Change-Id: Ibcb011848821fa2392965709771cee7737e67a95
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
Steinsplitter: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index f088d82..1eaf51a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1875,13 +1875,14 @@
# element into a list in the format used by old scripts
result = []
for template in templates:
- link = pywikibot.Link(template[0], self.site,
- defaultNamespace=10)
try:
+ link = pywikibot.Link(template[0], self.site,
+ defaultNamespace=10)
if link.canonical_title() not in titles:
continue
except pywikibot.Error:
# this is a parser function or magic word, not template name
+ # the template name might also contain invalid parts
continue
args = template[1]
intkeys = {}
--
To view, visit https://gerrit.wikimedia.org/r/193131
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcb011848821fa2392965709771cee7737e67a95
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.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: Steinsplitter <steinsplitter(a)wikipedia.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>