Page MenuHomePhabricator

APISite.siteinfo signature different between compat and core
Closed, ResolvedPublic

Description

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.

Event Timeline

jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb added subscribers: Unknown Object (MLST), valhallasw, jayvdb.

The Siteinfo class 'just' needs implement __call__ and deprecate it (similar to how APISite.namespaces() is now a property but could be still called).

XZise renamed this task from APISite.siteinfo to APISite.siteinfo signature different between compact and core.Jun 8 2015, 12:16 PM
XZise claimed this task.
XZise set Security to None.

Change 216677 had a related patch set uploaded (by XZise):
[IMPROV] Siteinfo: Support compat like calls

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

Change 216677 merged by jenkins-bot:
[IMPROV] Siteinfo: Support compat like calls

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

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.

Ricordisamoa renamed this task from APISite.siteinfo signature different between compact and core to APISite.siteinfo signature different between compat and core.Jun 8 2015, 5:29 PM
Ricordisamoa edited subscribers, added: Ricordisamoa; removed: gerritbot.

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. :/

I'm not sure which tests you are expecting but the issue has been fixed in ead5ee07.