From 75d4b0456064c6a6d593ac8ee3abb05a26763bf6 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Dec 07 2017 21:24:43 +0000 Subject: Don't pass `oldtext` kwarg to mwclient `save()` method As a convenience, wikitcms allows you to pass an `oldtext` kwarg to its `Page.save()` method and will skip the remote roundtrip if the `oldtext` and the text you asked it to save are the same. But if you use this convenience mechanism (as relval does) and the text is *not* the same, wikitcms will pass the `oldtext` kwarg along to the parent `save()` method (from mwclient), which does not understand it and will print a warning about it. So let's stop doing that, to avoid the warning. Signed-off-by: Adam Williamson --- diff --git a/wikitcms/page.py b/wikitcms/page.py index 0dfed4b..8255116 100644 --- a/wikitcms/page.py +++ b/wikitcms/page.py @@ -127,6 +127,11 @@ class Page(mwp.Page): """ if 'oldtext' in kwargs and args[0] == kwargs['oldtext']: return dict(nochange='') + + if 'oldtext' in kwargs: + # avoid mwclient save() warning about unknown kwarg + del kwargs['oldtext'] + try: ret = super(Page, self).save(*args, **kwargs) except mwe.EditError as err: