[Pywikipedia-l] Categories with namespace names (e.g. Category:Wikipedia:foo)
Morten Wang
nettrom at gmail.com
Tue Jun 14 15:11:56 UTC 2011
Hi,
Noticed one of my scripts failing because I tried to instantiate a category
named "Wikipedia:Globalt perspektiv-samtliga" (it's in Swedish Wikipedia,
here's the actual category:
http://sv.wikipedia.org/wiki/Kategori:Wikipedia:Globalt_perspektiv-samtliga)
This fails:
myCat = pywikibot.Category(mySite, "Wikipedia:Globalt
perspektiv-samtliga");
The error is:
ValueError: 'Wikipedia:Globalt perspektiv-samtliga' is not in the
category namespace!
Creating it as a page with namespace set to 14 results in:
>>> myPage = pywikibot.Page(mySite, 'Wikipedia:Globalt
perspektiv-samtliga', ns=14);
>>> print myPage.title();
Wikipedia:Globalt perspektiv-samtliga
>>> print myPage.namespace();
4
The title's namespace overrides the given option, which itsn't what I would
expect. However, if I add the category namespace prefix to the title
(localised to Swedish it's "Kategori:Wikipedia:Globalt
perspektiv-samtliga"), I get the right namespace and such.
Not sure if this is a bug or a feature, so I figured I'd post a note here
and see if anyone had any views on it, rather than just file the bug in SF.
Cheers,
Morten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/pywikipedia-l/attachments/20110614/608411e2/attachment.htm
More information about the Pywikipedia-l
mailing list