jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/634190 )
Change subject: [IMPR] issue deprecation warning for Page.protect()
......................................................................
[IMPR] issue deprecation warning for Page.protect()
Issue a clear deprecation warning for deprecated args
of Page.protect():
- edit, move, create, upload, unprotect and prompt
Bug: T227610
Change-Id: Ic232eae0113c261d7caa18effe3b946865c16f34
---
M pywikibot/page/__init__.py
1 file changed, 14 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index d9be9f3..55c9a23 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -2006,9 +2006,12 @@
value = ''
if value is not None: # empty string is allowed
protections[arg_name] = value
- warn('"protections" argument of protect() replaces "{0}"'
- .format(arg_name),
- FutureWarning)
+ issue_deprecation_warning(
+ '"{}" argument of protect()'.format(arg_name),
+ '"protections" dict',
+ warning_class=FutureWarning,
+ since='20140815')
+
else:
if value:
warn('"protections" argument of protect() replaces "{0}";'
@@ -2029,16 +2032,20 @@
% (self.title(as_link=True)))
reason = pywikibot.input('Please enter a reason for the action:')
if unprotect:
- warn('"unprotect" argument of protect() is deprecated',
- FutureWarning, 2)
+ issue_deprecation_warning(
+ '"unprotect" argument of protect()',
+ warning_class=FutureWarning,
+ since='20140815')
protections = {p_type: ''
for p_type in self.applicable_protections()}
answer = 'y'
if called_using_deprecated_arg and prompt is None:
prompt = True
if prompt:
- warn('"prompt" argument of protect() is deprecated',
- FutureWarning, 2)
+ issue_deprecation_warning(
+ '"prompt" argument of protect()',
+ warning_class=FutureWarning,
+ since='20140815')
if prompt and not hasattr(self.site, '_noProtectPrompt'):
answer = pywikibot.input_choice(
'Do you want to change the protection level of %s?'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/634190
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic232eae0113c261d7caa18effe3b946865c16f34
Gerrit-Change-Number: 634190
Gerrit-PatchSet: 2
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged