XZise has uploaded a new change for review.
https://gerrit.wikimedia.org/r/200153
Change subject: [FEAT] ParamInfo: Guess write using mustbeposted
......................................................................
[FEAT] ParamInfo: Guess write using mustbeposted
Almost all default write actions (apart from purge) must be POSTed so
it can guess that actions that are POSTed (except for login) are also
write actions.
Change-Id: I65fa9ffcfd25f18d8589160485c3c5a318f0a046
---
M pywikibot/data/api.py
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/53/200153/1
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 71cc0a9..ab620e4 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -494,6 +494,15 @@
if (help_text.find('\n\nThis module only accepts POST '
'requests.\n', start) < end):
self._paraminfo[path]['mustbeposted'] = ''
+ # All actions which must be POSTed are write actions except for
+ # login. Because Request checks if the user is logged in when
+ # doing a write action the check would always fail on login.
+ # Purge is the onl action which isn't POSTed but actually does
+ # write to it. This was checked with the data from 1.25wmf22 on
+ # en.wikipedia.org.
+ if ('mustbeposted' in self._paraminfo[path] and
+ path != 'login') or path == 'purge':
+ self._paraminfo[path]['writerights'] = ''
self._emulate_pageset()
--
To view, visit https://gerrit.wikimedia.org/r/200153
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65fa9ffcfd25f18d8589160485c3c5a318f0a046
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits