jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/534927 )

Change subject: Deprecate the ability to login with a secondary sysop account
......................................................................

Deprecate the ability to login with a secondary sysop account

Once this patch is merged, any part of the code that used to rely on
a secondary sysop account (through the use of sysopnames) should stop
working. I am intentioally postponing the removal of sysopnames from
other parts of code (specifically, pywikibot/__init__.py) to a later
time because this "agile" patch will give us the opportunity of
receiving feedback from users without waiting for a much larger change
to be reviewed.

Bug: T71283
Change-Id: I577ed1b2128856920a8e2a531a53df9fa0e8c5c5
---
M pywikibot/login.py
1 file changed, 10 insertions(+), 21 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/login.py b/pywikibot/login.py
index 3bc7661..4fbe0e9 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -60,8 +60,8 @@
 
     """Site login manager."""

-    @deprecated_args(username='user', verbose=None)
-    def __init__(self, password=None, sysop=False, site=None, user=None):
+    @deprecated_args(username='user', verbose=None, sysop=False)
+    def __init__(self, password=None, site=None, user=None):
         """
         Initializer.

@@ -74,18 +74,12 @@
         @type user: basestring
         @param password: password to use
         @type password: basestring
-        @param sysop: login as sysop account.
-            The sysop username is loaded from config.sysopnames.
-        @type sysop: bool

         @raises NoUsername: No username is configured for the requested site.
         """
         site = self.site = site or pywikibot.Site()
         if not user:
-            if sysop:
-                config_names = config.sysopnames
-            else:
-                config_names = config.usernames
+            config_names = config.usernames

             code_to_usr = config_names[site.family.name] or config_names['*']
             try:
@@ -93,13 +87,12 @@
             except KeyError:
                 raise NoUsername(
                     'ERROR: '
-                    '{account} for {fam_name}:{wiki_code} is undefined.\n'
-                    'If you have a {account} for that site, '
+                    'username for {site.family.name}:{site.code} is undefined.'
+                    '\nIf you have a username for that site, '
                     'please add a line to user-config.py as follows:\n'
-                    "{account}s['{fam_name}']['{wiki_code}'] = 'myUsername'"
-                    .format(
-                        fam_name=site.family.name, wiki_code=site.code,
-                        account='sysopname' if sysop else 'username'))
+                    "usernames['{site.family.name}']['{site.code}'] = "
+                    "'myUsername'"
+                    .format(site=site))
         self.password = password
         self.login_name = self.username = user
         if getattr(config, 'password_file', ''):
@@ -212,7 +205,6 @@
         Example::

          ('my_username', 'my_default_password')
-         ('my_sysop_user', 'my_sysop_password')
          ('wikipedia', 'my_wikipedia_user', 'my_wikipedia_pass')
          ('en', 'wikipedia', 'my_en_wikipedia_user', 'my_en_wikipedia_pass')
          ('my_username', BotPassword(
@@ -364,7 +356,8 @@
     # NOTE: Currently OauthLoginManager use mwoauth directly to complete OAuth
     # authentication process

-    def __init__(self, password=None, sysop=False, site=None, user=None):
+    @deprecated_args(sysop=False)
+    def __init__(self, password=None, site=None, user=None):
         """
         Initializer.

@@ -376,9 +369,6 @@
         @type user: basestring
         @param password: consumer secret
         @type password: basestring
-        @param sysop: login as sysop account.
-            The sysop username is loaded from config.sysopnames.
-        @type sysop: bool

         @raises NoUsername: No username is configured for the requested site.
         @raises OAuthImpossible: mwoauth isn't installed
@@ -386,7 +376,6 @@
         if isinstance(mwoauth, ImportError):
             raise OAuthImpossible('mwoauth is not installed: %s.' % mwoauth)
         assert password is not None and user is not None
-        assert sysop is False
         super(OauthLoginManager, self).__init__(None, False, site, None)
         if self.password:
             pywikibot.warn('Password exists in password file for %s:%s.'

--
To view, visit https://gerrit.wikimedia.org/r/534927
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I577ed1b2128856920a8e2a531a53df9fa0e8c5c5
Gerrit-Change-Number: 534927
Gerrit-PatchSet: 5
Gerrit-Owner: Huji <[email protected]>
Gerrit-Reviewer: Framawiki <[email protected]>
Gerrit-Reviewer: Huji <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to