Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F23174356
T122763 (2)
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Dalba
Jul 1 2018, 11:03 AM
2018-07-01 11:03:05 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
T122763 (2)
View Options
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c305dda8..cf7df7a0 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -555,6 +555,8 @@ class ParamInfo(Container):
# query modules can be prefixed with 'query+'
self._init()
+ modules = self._modules_to_set(modules)
+
if self._action_modules:
# The query module may be added before the action modules have been
if 'query' in self._modules:
@@ -735,12 +737,21 @@ class ParamInfo(Container):
assert param['name'] == 'generator' and \
submodules >= set(param['type'])
- def _normalize_modules(self, modules):
- """Add query+ to any query module name not also in action modules."""
- # Users will supply the wrong type, and expect it to work.
+ @staticmethod
+ def _modules_to_set(modules):
+ """Return modules as a set.
+
+ @type modules: Iterable, basestring, set
+ @rtype: set
+ """
+ if isinstance(modules, set):
+ return modules
if isinstance(modules, basestring):
- modules = set(modules.split('|'))
+ return set(modules.split('|'))
+ return set(modules)
+ def _normalize_modules(self, modules):
+ """Add query+ to any query module name not also in action modules."""
assert(self._action_modules)
return {'query+' + mod
@@ -759,7 +770,7 @@ class ParamInfo(Container):
@rtype: set
"""
self._init()
- return self._normalize_modules(modules)
+ return self._normalize_modules(self._modules_to_set(modules))
@classmethod
def normalize_paraminfo(cls, data):
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6078195
Default Alt Text
T122763 (2) (1 KB)
Attached To
Mode
P7322 T122763 (2)
Attached
Detach File
Event Timeline
Log In to Comment