jayvdb created this task.
jayvdb added a subscriber: jayvdb.
jayvdb added a project: pywikibot-core.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  `APISite.assert_valid_iter_params` is a normal method, but it does not use 
`self`.  It has only been implemented on APISite methods where the parameter 
names are consistently `start`, `end`, `reverse`.
  
  ```
  $ git grep assert_valid_iter_params
  pywikibot/site.py:    def assert_valid_iter_params(self, msg_prefix, start, 
end, reverse):
  pywikibot/site.py:            self.assert_valid_iter_params('logevents', 
start, end, reverse)
  pywikibot/site.py:            self.assert_valid_iter_params('recentchanges', 
start, end, reverse)
  pywikibot/site.py:            self.assert_valid_iter_params('usercontribs', 
start, end, reverse)
  pywikibot/site.py:            self.assert_valid_iter_params('watchlist_revs', 
start, end, reverse)
  pywikibot/site.py:            self.assert_valid_iter_params('deletedrevs', 
start, end, reverse)
  ```
  
  As a quick check against compat reveals the core parameter names are correct.
  # logevents was logpages, and had `start` and `end`
  # recentchanges used `rcstart` and `rcend`, which core supports using 
deprecated_args
  # usercontribs wasnt a Site method in compat; the API calls were inside 
userlib.User.contributions, which didnt expose start/end parameters
  # watchlist_revs wasnt implemented at all in compat
  # deletedrevs wasnt a Site method in compat; the API calls were inside 
Page.loadDeletedRevisions, which didnt expose start/end parameters
  
  The existing validator could be added to other methods that re-use the above 
methods, however that would require the validation is run twice
  * newpages has start, end & reverse, and it uses recentchanges.  if those 
parameters are incorrect, currently the error will say 'recentchanges', however 
it could say 'newpages'.
  * newfiles has start, end & reverse
  
  If this is rebuilt as a decorator, it can be more flexible about the 
parameter names.  Other APISite methods where this validation can be used:
  * categorymembers (starttime, endtime, reverse)
  * loadrevisions (starttime, endtime, rvdir)
  * blocks (starttime, endtime, reverse)
  
  Also on Page, the following could use the validation:
  * revisions has starttime, endtime and reverse (and uses 
APISite.loadrevisions)
  * contributors has starttime and endtime (and uses Page.revisions)
  * Category.articles has starttime, endtime & reverse (and uses 
APISite.categorymembers)

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

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

To: jayvdb
Cc: Aklapper, jayvdb, pywikibot-bugs-list, Malyacko, P.Copp



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

Reply via email to