[Pywikipedia-l] Categories with namespace names(e.g.Category:Wikipedia:foo)

Russell Blau russblau at imapmail.org
Fri Jul 15 14:46:53 UTC 2011


Morten Wang wrote:
> On Tue, Jun 14, 2011 at 12:28 PM, Russell Blau <russblau at imapmail.org> 
> wrote:
...
>>> 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.
>>
>> That one does seem like a bug.  The namespace number ought to match the
>> actual title.  I'll investigate further.
>
> Thanks, let me know if there's anything I can do to help!

Sorry for the delay in getting to this. On further study, this is exactly 
the same behavior as found in the original wikipedia.py.

>>> import wikipedia
>>> mySite = wikipedia.getSite()
>>> myPage = wikipedia.Page(mySite, 'Wikipedia:Globalt perspektiv-samtliga', 
>>> defaultNamespace=14)
>>> print myPage.title()
Wikipedia:Globalt perspektiv-samtliga
>>> print myPage.namespace()
4

So, if there is a bug, it is not in the rewrite branch but in the original 
design.  I don't think it is a bug, though, because "defaultNamespace" is 
supposed to be applied only when the string passed to the Page constructor 
does not contain any namespace prefix.

Russ




More information about the Pywikipedia-l mailing list