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:
--
To view, visit
https://gerrit.wikimedia.org/r/139701
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic685582d92f4df3339212b52a86550913c7a2b55
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>