jenkins-bot submitted this change.

View Change

Approvals: Matěj Suchánek: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] Raise an exception if 'titles' is still used as where parameter

'titles' value for where parameter was deprecated 5 years ago.

Change-Id: I0b9530be65db2a017cab5cbc4395cf47191a0dff
---
M pywikibot/site/_generators.py
1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index ca50567..66d03c9 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1296,27 +1296,23 @@
:raises TypeError: a namespace identifier has an inappropriate
type such as NoneType or bool
"""
- where_types = ['nearmatch', 'text', 'title', 'titles']
+ where_types = ['nearmatch', 'text', 'title']
if not searchstring:
raise Error('search: searchstring cannot be empty')
if where not in where_types:
raise Error("search: unrecognized 'where' value: {}".format(where))
- if where in ('title', 'titles'):
- 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')
+ if where == 'title' \
+ and 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
+ where = None # default

if not namespaces and namespaces != 0:
namespaces = [ns_id for ns_id in self.namespaces if ns_id >= 0]

To view, visit change 735951. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0b9530be65db2a017cab5cbc4395cf47191a0dff
Gerrit-Change-Number: 735951
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged