jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/349470 )
Change subject: Improve argument handling in allow_asynchronous decorator
......................................................................
Improve argument handling in allow_asynchronous decorator
The previous signature didn't play well with positional arguments.
Change-Id: Ia24130f3b39e816556cbf5f2a6620e09663649fc
---
M pywikibot/page.py
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 6295b21..b57317e 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -113,7 +113,9 @@
a callable that gets the page as the first and a possible exception that
occurred during saving in the second thread or None as the second argument.
"""
- def handle(func, self, do_async=False, callback=None, *args, **kwargs):
+ def handle(func, self, *args, **kwargs):
+ do_async = kwargs.pop('asynchronous', False)
+ callback = kwargs.pop('callback', None)
err = None
try:
func(self, *args, **kwargs)
@@ -131,10 +133,8 @@
callback(self, err)
def wrapper(self, *args, **kwargs):
- do_async = kwargs.pop('asynchronous', False)
- if do_async:
- pywikibot.async_request(handle, func, self, do_async=True,
- *args, **kwargs)
+ if kwargs.get('asynchronous'):
+ pywikibot.async_request(handle, func, self, *args, **kwargs)
else:
handle(func, self, *args, **kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/349470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia24130f3b39e816556cbf5f2a6620e09663649fc
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Magul <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits