Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78076
Change subject: Bugfix: don't pass args as kwargs
......................................................................
Bugfix: don't pass args as kwargs
Change-Id: I1c932d3bee462d1d1112db10029ac1b8ebf29c83
---
M server/eventlogging/factory.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging
refs/changes/76/78076/1
diff --git a/server/eventlogging/factory.py b/server/eventlogging/factory.py
index 6adddda..ec17fbe 100644
--- a/server/eventlogging/factory.py
+++ b/server/eventlogging/factory.py
@@ -19,14 +19,15 @@
def apply_safe(f, kwargs):
- """Apply a function with only those kwargs that it would accept."""
+ """Apply a function with only those arguments that it would accept."""
# If the function takes a '**' arg, all keyword args are safe.
# If it doesn't, we have to remove any arguments that are not
# present in the function's signature.
sig = inspect.getargspec(f)
if sig.keywords is None:
kwargs = {k: v for k, v in items(kwargs) if k in sig.args}
- return f(**kwargs)
+ args = [kwargs.pop(k) for k in sig.args[:-len(sig.defaults)]]
+ return f(*args, **kwargs)
def handle(handlers, uri):
--
To view, visit https://gerrit.wikimedia.org/r/78076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c932d3bee462d1d1112db10029ac1b8ebf29c83
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits