jayvdb added a comment.

During code review I noticed that `watchpage` was issuing an 'error' level 
logging message when the API result did not contain the expected data element 
`watch`.  IMO this should be an exception (even an assertion), not a UI error 
message.

e.g. editpage does

  assert "edit" in result and "result" in result["edit"], result

with only a UI error message, it is not possible for the caller to distinguish 
between malformed API response, and a failure to (un)watch only one page (e.g. 
`s.watchpage('Foo|Special:Goo')` returns False )

However if we introduced an assertion/exception here for 1.23+, we would need 
also change the <1.23 code to use an assertion/exception.  That would be a 
slightly breaking change to existing behaviour; personally speaking, do not 
mind that breaking change if documented, as it is more sane behaviour for a 
very unlikely scenario, so very few people will experience the breakage.

However an alternative, which avoids a breaking change, is to create a new 
method 'watchpages' (i.e. plural) (or just 'watch'?) that uses 
exceptions/assertions, and deprecate the existing 'watchpage' method which does 
this UI error message.


TASK DETAIL
  https://phabricator.wikimedia.org/T103736

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dalba, jayvdb
Cc: Dalba, gerritbot, StudiesWorld, jayvdb, Aklapper, pywikibot-bugs-list, XZise



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to