jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/668004 )
Change subject: [IMPR] only add bot option generator if the bot class have it already ......................................................................
[IMPR] only add bot option generator if the bot class have it already
Change-Id: I298ff92cda2803d38e44480f5122303215e4f9bb --- M pywikibot/bot.py 1 file changed, 7 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index a8945ea..8270f64 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -1173,13 +1173,17 @@ _current_page = None
def __init__(self, **kwargs): - """ - Only accept options defined in available_options. + """Only accept 'generator' and options defined in available_options.
@param kwargs: bot options + @keyword generator: a generator processed by run method """ if 'generator' in kwargs: - self.generator = kwargs.pop('generator') + if hasattr(self, 'generator'): + pywikibot.warn('{} has a generator already. Ignoring argument.' + .format(self.__class__.__name__)) + else: + self.generator = kwargs.pop('generator')
super().__init__(**kwargs)