jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] return a list of names for category_namespaces ......................................................................
[bugfix] return a list of names for category_namespaces
- category_namespaces did return a Namespace object instead a list of names which was supposed to. Convert the iterator to a list to solve it. - also add some further documentation for site.namespace(): site.namespace(num, True) does not return a list but a Namespace object.
Change-Id: I0e2d5d9040c8b2fce25147b95ee55a255297d42e --- M pywikibot/site.py 1 file changed, 9 insertions(+), 2 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 538537c..c421fbf 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1196,7 +1196,7 @@ @deprecated('list(namespaces.CATEGORY)') def category_namespaces(self): """Return names for the Category namespace.""" - return self.namespace(14, all=True) + return list(self.namespace(14, all=True))
# site-specific formatting preferences
@@ -2826,8 +2826,15 @@ def namespace(self, num, all=False): """Return string containing local name of namespace 'num'.
- If optional argument 'all' is true, return a list of all recognized + If optional argument 'all' is true, return all recognized values for this namespace. + + @param num: Namespace constant. + @type num: int + @param all: If True return a Namespace object. Otherwise + return the namespace name. + @return: local name or Namespace object + @rtype: str or Namespace """ if all: return self.namespaces[num]
pywikibot-commits@lists.wikimedia.org