On Tue, Jun 14, 2011 at 12:28 PM, Russell Blau <[email protected]>wrote:

> That should fail; it would equally fail if you tried
>    myCat = pywikibot.Category(mySite, "Garbage")
> since "Garbage" is not in the Category namespace.  In other words, the fact
> that the category title starts with "Wikipedia:" has nothing to do with it.
>

Hm, I struggle to understand why your example is supposed to fail, it
attempts to create a Page object with title "Garbage" and ns=14, that's a
perfectly valid page, isn't it?  (except that myCat.exists() returns False,
of course, as expected)


> However, this should work:
>      myCat = pywikibot.Category(mySite, "Kategori:Wikipedia:Globalt
> perspektiv-samtliga");
>

Yes, that does work, so I've chosen to go with the straightforward
workaround that I'll prefix any category name with site.category_namespace()
and ":".  That's partly why I chose to post to the list, in case that'll
just be defined as expected behaviour, I have no problem with having to
qualify the names that way :)

> 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!


Cheers,
Morten
_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to