jenkins-bot has submitted this change and it was merged.
Change subject: Fix NoPage exception in unusedfiles.py ......................................................................
Fix NoPage exception in unusedfiles.py
The page and not the title shall be passed to the exception.
Added also missing docstrings. Updated tox.ini [flake8-docstrings-mandatory] with: - unusedfiles.py - category.py
Change-Id: I1e2f65dac9ca734ed8e749a11cc063389170a11d --- M scripts/unusedfiles.py M tox.ini 2 files changed, 7 insertions(+), 2 deletions(-)
Approvals: XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py index 611bd90..a4c7fd9 100644 --- a/scripts/unusedfiles.py +++ b/scripts/unusedfiles.py @@ -13,7 +13,7 @@ # (C) Leonardo Gregianin, 2007 # (C) Filnik, 2008 # (c) xqt, 2011-2014 -# (C) Pywikibot team, 2014 +# (C) Pywikibot team, 2015 # # Distributed under the terms of the MIT license. # @@ -53,10 +53,12 @@ """Unused files bot."""
def __init__(self, site, **kwargs): + """Constructor.""" super(UnusedFilesBot, self).__init__(**kwargs) self.site = site
def run(self): + """Start the bot.""" template_image = i18n.translate(self.site, template_to_the_image) template_user = i18n.translate(self.site, @@ -89,6 +91,7 @@ self.append_text(usertalkpage, msg2uploader)
def append_text(self, page, apptext): + """Append apptext to the page.""" if page.isRedirectPage(): page = page.getRedirectTarget() if page.exists(): @@ -97,7 +100,7 @@ if page.isTalkPage(): text = u'' else: - raise pywikibot.NoPage(u"Page '%s' does not exist" % page.title()) + raise pywikibot.NoPage(page)
oldtext = text text += apptext diff --git a/tox.ini b/tox.ini index 5614737..050b795 100644 --- a/tox.ini +++ b/tox.ini @@ -62,6 +62,7 @@ scripts/basic.py \ scripts/blockpageschecker.py \ scripts/capitalize_redirects.py \ + scripts/category.py \ scripts/category_redirect.py \ scripts/claimit.py \ scripts/clean_sandbox.py \ @@ -86,6 +87,7 @@ scripts/states_redirect.py \ scripts/template.py \ scripts/transferbot.py \ + scripts/unusedfiles.py \ scripts/upload.py \ scripts/watchlist.py \ setup.py \
pywikibot-commits@lists.wikimedia.org