XZise has uploaded a new change for review.

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

Change subject: [FEAT] ParamInfo: Read mustbeposted from help
......................................................................

[FEAT] ParamInfo: Read mustbeposted from help

When it reads the ParamInfo data from the help text it can interpret the
help text to determine whether an action requires to be posted.

Change-Id: Ia24e5280f21973b2d386d1e8912f689a859d7b26
---
M pywikibot/data/api.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/97/199597/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index f2f6a98..c252353 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -430,6 +430,7 @@
                 start = help_text.find(mod_begin_string)
                 assert(start)
                 start += len(mod_begin_string)
+                end = help_text.find('\n*', start)
 
                 if help_text[start + 1] == '(' and help_text[start + 4] == ')':
                     prefix = help_text[start + 2:start + 4]
@@ -490,6 +491,9 @@
                         }
 
                 self._paraminfo[path]['parameters'] = params.values()
+                if (help_text.find('\n\nThis module only accepts POST '
+                                   'requests.\n', start) < end):
+                    self._paraminfo[path]['mustbeposted'] = ''
 
         self._emulate_pageset()
 

-- 
To view, visit https://gerrit.wikimedia.org/r/199597
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia24e5280f21973b2d386d1e8912f689a859d7b26
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

Reply via email to