Page MenuHomePhabricator

Breaking change for site.namespaces()
Closed, DeclinedPublicBUG REPORT

Description

There is a breaking change for site.namespaces on core. The old implementation of site.namespaces() gives a list of localized namespace aliases:

>>> import wikipedia as py
>>> s = py.getSite()
>>> s.namespaces()
['', u'Diskussion', u'Benutzer', u'Benutzer Diskussion', u'Wikipedia', u'Wikipedia Diskussion', u'Datei', u'Datei Diskussion', u'MediaWiki', u'MediaWiki Diskussion', u'Vorlage', u'Vorlage Diskussion', u'Hilfe', u'Hilfe Diskussion', u'Kategorie', u'Kategorie Diskussion', u'Modul', u'Modul Diskussion', u'Portal', u'Portal Diskussion', u'Medium', u'Spezial']
>>>

whereas core gives an namespace dict opject back:

>>> import pwb, pywikibot as py
>>> s = py.Site()
>>> s.namespaces()
<pywikibot.site.NamespacesDict object at 0x04A66610>

iterating over namespases gives the keys not the values:

>>> x = []
>>> x += [n for n in s.namespaces]
>>> x
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 2600, 828, 829, -2, 100, 101, -1, 2300, 2301, 2302, 2303]
>>>

Event Timeline

Xqt raised the priority of this task from to Unbreak Now!.
Xqt updated the task description. (Show Details)
Xqt added a project: Pywikibot.
Xqt subscribed.
Xqt lowered the priority of this task from Unbreak Now! to High.Feb 5 2016, 11:31 AM

I see the breaking change was the done in the first implementation of core where it was changed from list to dict. But is is neither documented in README-conversion.txt nor elsewhere. Anyway the namespaces.values() doesn't give me that list as expected.

Xqt added a project: Pywikibot-compat-to-core.
Xqt changed the subtype of this task from "Task" to "Bug Report".

Decline because this is to old and compat is dropped long time ago.