Page MenuHomePhabricator

Support titles parameter in watch action
Closed, ResolvedPublic

Description

Since some time the watch action supports a titles parameter and the title parameter has been deprecated.

Event Timeline

XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
XZise added a project: Pywikibot.
XZise subscribed.

Change 261903 had a related patch set uploaded (by Dalba):
site.py:Support titles parameter in watch action

https://gerrit.wikimedia.org/r/261903

Change 261904 had a related patch set uploaded (by Dalba):
site.py:Support titles parameter in watch action

https://gerrit.wikimedia.org/r/261904

Change 261903 abandoned by Dalba:
site.py:Support titles parameter in watch action

Reason:
This one has been committed by mistake (don't know how).

https://gerrit.wikimedia.org/r/261903

Dalba set Security to None.

As I mentioned on the code review, I would prefer that mw <1.23 supports multiple titles by iterating over the list of titles and watching each one. Thoughts on this?

This comment was removed by Dalba.

Agreed. I've uploaded another patch for that.

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.

Change 261904 merged by jenkins-bot:
site.py: Support titles parameter in watch action

https://gerrit.wikimedia.org/r/261904