jenkins-bot has submitted this change and it was merged.
Change subject: (bug 58892) Fixing NameError in pagefromfile.py ......................................................................
(bug 58892) Fixing NameError in pagefromfile.py
The error can be easily fixed copying the core code. It's one of my old mistakes, It returned NameError because I used an undefined variable.
Change-Id: Ic685582d92f4df3339212b52a86550913c7a2b55 --- M pagefromfile.py 1 file changed, 10 insertions(+), 20 deletions(-)
Approvals: John Vandenberg: Checked; Looks good to me, approved jenkins-bot: Verified
diff --git a/pagefromfile.py b/pagefromfile.py index 23a46ef..8c780fa 100644 --- a/pagefromfile.py +++ b/pagefromfile.py @@ -187,29 +187,19 @@ contents = re.sub('^[\r\n]*', '', contents)
if page.exists(): - if self.append == "Top": - if appendtops.find(self.nocontents) == -1 and \ - appendtops.find(self.nocontents.lower()) == -1: - contents += appendtops - pywikibot.output( - u"Page %s already exists, appending on top!" - % title) - else: - pywikibot.output(u'Page had %s so it is skipped' - % (self.nocontents)) + if self.nocontent != u'': + pagecontents = page.get() + if pagecontents.find(self.nocontent) != -1 or pagecontents.find(self.nocontent.lower()) != -1: + pywikibot.output(u'Page has %s so it is skipped' % (self.nocontent)) return - contents += page.get() + if self.append == "Top": + pywikibot.output(u"Page %s already exists, appending on top!" + % title) + contents = contents + page.get() comment = comment_top elif self.append == "Bottom": - if appendtops.find(self.nocontents) == -1 and \ - appendtops.find(self.nocontents.lower()) == -1: - contents += appendtops - pywikibot.output( - u"Page %s already exists, appending on bottom!" - % title) - else: - pywikibot.output(u'Page had %s so it is skipped' % (self.nocontents)) - return + pywikibot.output(u"Page %s already exists, appending on bottom!" + % title) contents = page.get() + contents comment = comment_bottom elif self.force:
pywikibot-commits@lists.wikimedia.org