jenkins-bot merged this change.
[IMPR] Check for missing generator after setup() call
Bot.setup may create the generator.
Therefore check for it after setup()
call in front of the loop.
Change-Id: I73e01d3526b6e3248a23333d4f72866f7f187232
---
M pywikibot/bot.py
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 4d1cfcc..e234c09 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1385,16 +1385,16 @@
@raise AssertionError: "page" is not a pywikibot.page.BasePage object
"""
self._start_ts = pywikibot.Timestamp.now()
+ self.setup()
+
if not hasattr(self, 'generator'):
raise NotImplementedError('Variable %s.generator not set.'
% self.__class__.__name__)
-
if PY2:
# Python 2 does not clear previous exceptions and method `exit`
# relies on sys.exc_info returning exceptions occurring in `run`.
sys.exc_clear()
- self.setup()
try:
for item in self.generator:
# preprocessing of the page
To view, visit change 598157. To unsubscribe, or for help writing mail filters, visit settings.