jenkins-bot has submitted this change and it was merged.
Change subject: Sort package keys
......................................................................
Sort package keys
Because we aren't ready reading i18n directly from json files,
we have to use the current files. Due to updating these files
from json files it is necessary to sort it's contents first
so that we can confirm further changes in an easy way.
Change-Id: I2be6b39cec882c60d45e6c436c538613fa3bafa7
---
M archivebot.py
M basic.py
M capitalize_redirects.py
M casechecker.py
M catall.py
M category.py
M category_redirect.py
M clean_sandbox.py
M commons.py
M commons_link.py
M cosmetic_changes.py
M delete.py
M editarticle.py
M featured.py
M fixing_redirects.py
M interwiki.py
M isbn.py
M lonelypages.py
M movepages.py
M noreferences.py
M pagefromfile.py
M protect.py
M pywikibot.py
M redirect.py
M reflinks.py
M replace.py
M solve_disambiguation.py
M table2wiki.py
M template.py
M thirdparty.py
M unlink.py
M weblinkchecker.py
M welcome.py
33 files changed, 5,083 insertions(+), 5,086 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
--
To view, visit https://gerrit.wikimedia.org/r/183037
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2be6b39cec882c60d45e6c436c538613fa3bafa7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Add ParamInfo support for v1.15-18
......................................................................
Add ParamInfo support for v1.15-18
Version before 1.19 need to obtain the query modules from the
paraminfo for the query module.
In earlier versions, for modules which do not have any parameters,
such as categoryinfo, the parameters member may be missing from the
paraminfo structure.
Bug: T85786
Change-Id: I779c7637d11a218ba389b05b222a384a0296b822
---
M pywikibot/data/api.py
M tests/api_tests.py
2 files changed, 38 insertions(+), 16 deletions(-)
Approvals:
XZise: Looks good to me, but someone else must approve
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 5225322..04245ce 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -187,22 +187,29 @@
self.paraminfo_keys = frozenset(['modules'])
def _init(self):
+ _mw_ver = MediaWikiVersion(self.site.version())
# The paraminfo api deprecated the old request syntax of
# querymodules='info'; to avoid warnings sites with 1.25wmf4+
# must only use 'modules' parameter.
if self.modules_only_mode is None:
- self.modules_only_mode = MediaWikiVersion(self.site.version()) >= MediaWikiVersion('1.25wmf4')
+ self.modules_only_mode = _mw_ver >= MediaWikiVersion('1.25wmf4')
if self.modules_only_mode:
self.paraminfo_keys = frozenset(['modules'])
- # Assume that by v1.26, it will be desirable to prefetch 'query'
- if MediaWikiVersion(self.site.version()) > MediaWikiVersion('1.26'):
- self.preloaded_modules |= set(['query'])
+
+ # v1.18 and earlier paraminfo doesnt include modules; must use 'query'
+ # Assume that by v1.26, it will be desirable to prefetch 'query'
+ if _mw_ver > MediaWikiVersion('1.26') or _mw_ver < MediaWikiVersion('1.19'):
+ self.preloaded_modules |= set(['query'])
self.fetch(self.preloaded_modules, _init=True)
+
+ # paraminfo 'mainmodule' was added 1.15
+ assert('main' in self._paraminfo)
main_modules_param = self.parameter('main', 'action')
assert(main_modules_param)
assert('type' in main_modules_param)
+ assert(isinstance(main_modules_param['type'], list))
self._action_modules = frozenset(main_modules_param['type'])
# While deprecated with warning in 1.25, paraminfo param 'querymodules'
@@ -214,26 +221,35 @@
assert('limit' in query_modules_param)
self._limit = query_modules_param['limit']
- if query_modules_param:
- assert('type' in query_modules_param)
- self._query_modules = frozenset(query_modules_param['type'])
- else:
+ if query_modules_param and 'type' in query_modules_param:
+ # 1.19+ 'type' is the list of modules; on 1.18, it is 'string'
+ if isinstance(query_modules_param['type'], list):
+ self._query_modules = frozenset(query_modules_param['type'])
+
+ if not self._query_modules:
if 'query' not in self._paraminfo:
self.fetch(set(['query']), _init=True)
+ meta_param = self.parameter('query', 'meta')
prop_param = self.parameter('query', 'prop')
list_param = self.parameter('query', 'list')
generator_param = self.parameter('query', 'generator')
+ assert(meta_param)
assert(prop_param)
assert(list_param)
assert(generator_param)
+ assert('type' in meta_param)
assert('type' in prop_param)
assert('type' in list_param)
assert('type' in generator_param)
+ assert(isinstance(meta_param['type'], list))
+ assert(isinstance(prop_param['type'], list))
+ assert(isinstance(list_param['type'], list))
+ assert(isinstance(generator_param['type'], list))
self._query_modules = frozenset(
- prop_param['type'] + list_param['type'] +
+ meta_param['type'] + prop_param['type'] + list_param['type'] +
generator_param['type']
)
@@ -343,7 +359,8 @@
for paraminfo_key, modules_data
in data['paraminfo'].items()
if modules_data and paraminfo_key in cls.paraminfo_keys]
- for mod_data in modules_data])
+ for mod_data in modules_data
+ if 'missing' not in mod_data])
def __getitem__(self, key):
"""Return a paraminfo property, caching it."""
@@ -377,7 +394,14 @@
# also params which are common to many modules, such as those provided
# by the ApiPageSet php class: titles, pageids, redirects, etc.
self.fetch(set([module]))
- param_data = [param for param in self._paraminfo[module]['parameters']
+ if module not in self._paraminfo:
+ raise ValueError("paraminfo for '%s' not loaded" % module)
+ if 'parameters' not in self._paraminfo[module]:
+ pywikibot.warning("module '%s' has no parameters" % module)
+ return
+
+ params = self._paraminfo[module]['parameters']
+ param_data = [param for param in params
if param['name'] == param_name]
return param_data[0] if len(param_data) else None
diff --git a/tests/api_tests.py b/tests/api_tests.py
index de05bed..c417356 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -69,16 +69,16 @@
self.assertIn('main', pi)
self.assertIn('paraminfo', pi)
self.assertEqual(len(pi),
- len(pi.init_modules))
+ len(pi.preloaded_modules))
self.assertIn('info', pi._query_modules)
+ self.assertIn('login', pi._action_modules)
def test_init_pageset(self):
site = self.get_site()
self.assertNotIn('query', api.ParamInfo.init_modules)
pi = api.ParamInfo(site, set(['pageset']))
self.assertNotIn('query', api.ParamInfo.init_modules)
- self.assertNotIn('query', pi.preloaded_modules)
self.assertEqual(len(pi), 0)
pi._init()
@@ -86,12 +86,10 @@
self.assertIn('paraminfo', pi)
self.assertIn('pageset', pi)
- if pi.modules_only_mode:
- self.assertIn('query', pi.preloaded_modules)
+ if 'query' in pi.preloaded_modules:
self.assertIn('query', pi)
self.assertEqual(len(pi), 4)
else:
- self.assertNotIn('query', pi.preloaded_modules)
self.assertNotIn('query', pi)
self.assertEqual(len(pi), 3)
--
To view, visit https://gerrit.wikimedia.org/r/182088
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I779c7637d11a218ba389b05b222a384a0296b822
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Maverick <manpreetkaur9411(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Nemo bis <federicoleva(a)tiscali.it>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for priyankajayaswal1/pywikibot-core
-------------------------------------
Build: #5
Status: Failed
Duration: 35 minutes and 50 seconds
Commit: 934c201 (match_images)
Author: priyankajayaswal1
Message: Create match_images.py
Added match_image.py in core/scripts/ as part of Pywikibot:Compat
to Core migration making it compatible with pywikibot module. Needed to
make use of http from pywikibot.comms for fetching URLs.
Bug T66871
View the changeset: https://github.com/priyankajayaswal1/pywikibot-core/compare/dc49851a8183...…
View the full build log and details: https://travis-ci.org/priyankajayaswal1/pywikibot-core/builds/45846967
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for priyankajayaswal1/pywikibot-core
-------------------------------------
Build: #4
Status: Errored
Duration: 42 minutes and 18 seconds
Commit: 934c201 (match_images)
Author: priyankajayaswal1
Message: Create match_images.py
Added match_image.py in core/scripts/ as part of Pywikibot:Compat
to Core migration making it compatible with pywikibot module. Needed to
make use of http from pywikibot.comms for fetching URLs.
Bug T66871
View the changeset: https://github.com/priyankajayaswal1/pywikibot-core/compare/dc49851a8183...…
View the full build log and details: https://travis-ci.org/priyankajayaswal1/pywikibot-core/builds/45846483
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for priyankajayaswal1/pywikibot-core
-------------------------------------
Build: #1
Status: Errored
Duration: 35 minutes and 16 seconds
Commit: e5a09a8 (master)
Author: priyankajayaswal1
Message: Create match_images.py
Added match_image.py in core/scripts/ as part of Pywikibot:Compat
to Core migration making it compatible with pywikibot module. Needed to
make use of external module urllib2 for fetching URLs.
Bug T66871
View the changeset: https://github.com/priyankajayaswal1/pywikibot-core/compare/68d9088ec910...…
View the full build log and details: https://travis-ci.org/priyankajayaswal1/pywikibot-core/builds/45845918
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications