The compat method spec is
def siteinfo(self, key='general', force=False, dump=False):
In core it is
@property def siteinfo(self):
Need tests and probably fixes to make that backwards compatible.
The compat method spec is
def siteinfo(self, key='general', force=False, dump=False):
In core it is
@property def siteinfo(self):
Need tests and probably fixes to make that backwards compatible.
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[IMPROV] Siteinfo: Support compat like calls | pywikibot/core | master | +26 -1 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Invalid | None | T60941 Missing unit tests for pywikibot library (tracking) | |||
Resolved | XZise | T85322 APISite.siteinfo signature different between compat and core |
The Siteinfo class 'just' needs implement __call__ and deprecate it (similar to how APISite.namespaces() is now a property but could be still called).
Change 216677 had a related patch set uploaded (by XZise):
[IMPROV] Siteinfo: Support compat like calls
This should be fixed unless you specifically need the actual dict and not a deep copy. On the other hand dump=True exposes the actual cache.
A breakage
https://travis-ci.org/wikimedia/pywikibot-core/jobs/65987031
slightly reformatted:
FAIL: Test calling the Siteinfo without setting dump. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/build/wikimedia/pywikibot-core/tests/site_tests.py", line 81, in test_siteinfo_normal_call self.assertNotEqual(self.site.siteinfo('general', force=True), old) nose.proxy.AssertionError: {'phpversion': '5.6.99-hhvm', 'script': '/w/index.php', 'fallback': [], 'variantarticlepath': False, 'thumblimits': [120, 150, 180, 200, 220, 250, 300], 'langconversion': '', 'servername': 'test.wikidata.org', 'git-branch': 'wmf/1.26wmf8', 'legaltitlechars': ' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+', 'case': 'first-letter', 'invalidusernamechars': '@:', 'scriptpath': '/w', 'phpsapi': 'srv', 'linktrail': '/^([a-z]+)(.*)$/sD', 'generator': 'MediaWiki 1.26wmf8', 'logo': '//test.wikidata.org/static/images/project-logos/testwikidatawiki.png', 'titleconversion': '', 'sitename': 'Wikidata', 'timeoffset': 0, 'linkprefixcharset': '', 'hhvmversion': '3.6.1', 'dbtype': 'mysql', 'lang': 'en', 'mainpage': 'Wikidata:Main Page', 'imagewhitelistenabled': '', 'favicon': '//test.wikidata.org/static/favicon/testwikidata.ico', 'articlepath': '/wiki/$1', 'fallback8bitEncoding': 'windows-1252', 'linkprefix': '', 'git-hash': 'dab1803da438edfee5fbca59f034da57037b85b4', 'imagelimits': [{'width': 320, 'height': 240}, {'width': 640, 'height': 480}, {'width': 800, 'height': 600}, {'width': 1024, 'height': 768}, {'width': 1280, 'height': 1024}], 'dbversion': '10.0.16-MariaDB-log', 'wikiid': 'testwikidatawiki', 'server': '//test.wikidata.org', 'writeapi': '', 'maxuploadsize': 1048576000, 'base': 'https://test.wikidata.org/wiki/Wikidata:Main_Page', 'misermode': '', 'time': '2015-06-09T02:41:54Z', 'timezone': 'UTC'} == {'phpversion': '5.6.99-hhvm', 'script': '/w/index.php', 'fallback': [], 'variantarticlepath': False, 'langconversion': '', 'servername': 'test.wikidata.org', 'git-branch': 'wmf/1.26wmf8', 'legaltitlechars': ' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+', 'case': 'first-letter', 'scriptpath': '/w', 'dbtype': 'mysql', 'hhvmversion': '3.6.1', 'generator': 'MediaWiki 1.26wmf8', 'writeapi': '', 'logo': '//test.wikidata.org/static/images/project-logos/testwikidatawiki.png', 'titleconversion': '', 'timeoffset': 0, 'linkprefixcharset': '', 'misermode': '', 'thumblimits': [120, 150, 180, 200, 220, 250, 300], 'phpsapi': 'srv', 'lang': 'en', 'mainpage': 'Wikidata:Main Page', 'imagewhitelistenabled': '', 'favicon': '//test.wikidata.org/static/favicon/testwikidata.ico', 'articlepath': '/wiki/$1', 'sitename': 'Wikidata', 'fallback8bitEncoding': 'windows-1252', 'linkprefix': '', 'git-hash': 'dab1803da438edfee5fbca59f034da57037b85b4', 'imagelimits': [{'width': 320, 'height': 240}, {'width': 640, 'height': 480}, {'width': 800, 'height': 600}, {'width': 1024, 'height': 768}, {'width': 1280, 'height': 1024}], 'dbversion': '10.0.16-MariaDB-log', 'wikiid': 'testwikidatawiki', 'linktrail': '/^([a-z]+)(.*)$/sD', 'server': '//test.wikidata.org', 'maxuploadsize': 1048576000, 'base': 'https://test.wikidata.org/wiki/Wikidata:Main_Page', 'invalidusernamechars': '@:', 'time': '2015-06-09T02:41:54Z', 'timezone': 'UTC'}
probably needs a sleep for one second to ensure the time has changed. :/