jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/699817 )
Change subject: [IMPR] Revise GeneratorsMixin's search deprecation ......................................................................
[IMPR] Revise GeneratorsMixin's search deprecation
Making the changes discussed in CR 693515 [1]...
* Deprecating any use of 'titles' in favor of 'title'. Previously its usage was only deprecated when the CirrusSearch extension isn't present.
* Only deprecate CirrusSearch's where usage when our family is a WikimediaFamily.
[1] https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693515
Change-Id: I94ffbba7a9dc398198e92d92a3708fa4582e8ff9 --- M pywikibot/site/_generators.py 1 file changed, 9 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py index 16d38fe..30f1245 100644 --- a/pywikibot/site/_generators.py +++ b/pywikibot/site/_generators.py @@ -1353,20 +1353,22 @@ if where not in where_types: raise Error("search: unrecognized 'where' value: {}".format(where)) if where in ('title', 'titles'): - if self.has_extension('CirrusSearch'): + if where == 'titles': + issue_deprecation_warning("where='titles'", "where='title'", + since='20160224') + where = 'title' + + if self.has_extension('CirrusSearch') and \ + isinstance(self.family, pywikibot.family.WikimediaFamily): # 'title' search was disabled, use intitle instead searchstring = 'intitle:' + searchstring issue_deprecation_warning( "where='{}'".format(where), "searchstring='{}'".format(searchstring), since='20160224') + where = None # default - else: - if where == 'titles': - issue_deprecation_warning("where='titles'", - "where='title'", - since='20160224') - where = 'title' + if not namespaces and namespaces != 0: namespaces = [ns_id for ns_id in self.namespaces if ns_id >= 0] srgen = self._generator(api.PageGenerator, type_arg='search',