jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/663188 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: I7aff3b58fa7074aea54530b336a86e05d5c2bb77
---
M ROADMAP.rst
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 684b401..be583ee 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,7 @@
Breaking changes
^^^^^^^^^^^^^^^^
+* Require setuptools >= 20.2 due to PEP 440
* Support of MediaWiki < 1.23 has been dropped (T268979)
* APISite.loadimageinfo will no longer return any content
* Return requests.Response with http.request() instead of plain text (T265206)
@@ -12,6 +13,9 @@
Other changes
^^^^^^^^^^^^^
+* textlib.removeDisabledPart is able to remove templates (T274138)
+* toStdout parameter of pywikibot.output() has been dropped
+* Deprecated Site.getToken() and Site.case was removed
* Create a SiteLink with __getitem__ method and implement lazy load (T273386, T245809, T238471, T226157)
* Fix date.formats['MonthName'] behaviour (T273573)
* Deprecated Family.known_families dict was removed (T89451)
@@ -33,7 +37,6 @@
* 5.5.0: Site.getglobaluserinfo() method will be dropped in favour of globaluserinfo property
* 5.4.0: LoginManager.getCookie() is deprecated and will be removed
* 5.4.0: tools.PY2 will be removed (T213287)
-* 5.3.0: toStdout parameter of logging.output()/pywikibot.output() function will be desupported
* 5.0.0: OptionHandler.options dict will be removed in favour of OptionHandler.opt
* 5.0.0: Methods deprecated for 5 years or longer will be removed
* 5.0.0: pagegenerators.ReferringPageGenerator is desupported and will be removed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/663188
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: I7aff3b58fa7074aea54530b336a86e05d5c2bb77
Gerrit-Change-Number: 663188
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/652606 )
Change subject: [IMPR] allow to pass a 'user' parameter with Site.login()
......................................................................
[IMPR] allow to pass a 'user' parameter with Site.login()
- allow to pass a 'user' parameter with Site.login(). This overrides
user parameter given with instantiating a BaseSite or username
set within user-config.py
Change-Id: I30bc5e283a79dc213d041cb50d7b21e77bdbdb0c
---
M pywikibot/site/_apisite.py
1 file changed, 29 insertions(+), 20 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 8e142c2..abf98f2 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -83,6 +83,7 @@
itergroup,
MediaWikiVersion,
merge_unique_dicts,
+ normalize_username,
remove_last_args,
)
@@ -322,13 +323,16 @@
return auth_token is not None and len(auth_token) == 4
@deprecated_args(sysop=True)
- def login(self, sysop=None, autocreate=False):
+ def login(self, sysop=None,
+ autocreate: bool = False,
+ user: Optional[str] = None):
"""
Log the user in if not already logged in.
@param autocreate: if true, allow auto-creation of the account
- using unified login
- @type autocreate: bool
+ using unified login
+ @param user: bot user name. Overrides the username set by
+ BaseSite initializer parameter or user-config.py setting
@raises pywikibot.exceptions.NoUsername: Username is not recognised
by the site.
@@ -350,6 +354,7 @@
pywikibot.log(
'{!r}.login() called when a previous login was in progress.'
.format(self))
+
# There are several ways that the site may already be
# logged in, and we do not need to hit the server again.
# logged_in() is False if _userinfo exists, which means this
@@ -357,13 +362,16 @@
if self.logged_in():
self._loginstatus = _LoginStatus.AS_USER
return
+
# check whether a login cookie already exists for this user
# or check user identity when OAuth enabled
self._loginstatus = _LoginStatus.IN_PROGRESS
+ self._username = normalize_username(user)
try:
del self.userinfo # force reload
if self.userinfo['name'] == self.user():
return
+
# May occur if you are not logged in (no API read permissions).
except api.APIError:
pass
@@ -372,24 +380,25 @@
raise e
if self.is_oauth_token_available():
- if self.userinfo['name'] != self.username():
- if self.username() is None:
- raise NoUsername('No username has been defined in your '
- 'user-config.py: you have to add in this '
- 'file the following line:\n'
- "usernames['{family}']['{lang}'] "
- "= '{username}'"
- .format(family=self.family,
- lang=self.lang,
- username=self.userinfo['name']))
- else:
- raise NoUsername('Logged in on {site} via OAuth as '
- '{wrong}, but expect as {right}'
- .format(site=self,
- wrong=self.userinfo['name'],
- right=self.username()))
- else:
+ if self.userinfo['name'] == self.username():
raise NoUsername('Logging in on %s via OAuth failed' % self)
+
+ if self.username() is None:
+ raise NoUsername('No username has been defined in your '
+ 'user-config.py: you have to add in this '
+ 'file the following line:\n'
+ 'usernames[{family!r}][{lang!r}]'
+ '= {username!r}'
+ .format(family=self.family,
+ lang=self.lang,
+ username=self.userinfo['name']))
+
+ raise NoUsername('Logged in on {site} via OAuth as '
+ '{wrong}, but expect as {right}'
+ .format(site=self,
+ wrong=self.userinfo['name'],
+ right=self.username()))
+
login_manager = api.LoginManager(site=self, user=self.username())
if login_manager.login(retry=True, autocreate=autocreate):
self._username = login_manager.username
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/652606
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: I30bc5e283a79dc213d041cb50d7b21e77bdbdb0c
Gerrit-Change-Number: 652606
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged