https://bugzilla.wikimedia.org/show_bug.cgi?id=54745
Web browser: ---
Bug ID: 54745
Summary: Page.iterlanglinks for a page on commons returns pages
on commons
Product: Pywikibot
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
>>> import pywikibot as p
>>> s=p.Site('commons','commons')
>>> pg=p.Page(s, 'New York City')
>>> for i in pg.iterlanglinks(): print i.site
...
commons:commons
<snip>
There are a few things that are working together to cause this:
iterlanglinks calls Site.pagelanglinks which does:
yield pywikibot.Link.langlinkUnsafe(linkdata['lang'],
linkdata['*'],
source=self)
In langlinkUnsafe, there is:
link._site = pywikibot.Site(lang, source.family.name)
Now, unfortunately for commons:
>>> p.Site('en','commons')
Site("commons", "commons")
Another issue is that
https://commons.wikimedia.org/w/api.php?action=query&titles=New%20York%20City&prop=langlinks
(the actual API query we make) only returns language codes, not full database
names.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l