jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/458359 )
Change subject: page.Link.langlinkUnsafe: Always set _namespace to a Namespace object ......................................................................
page.Link.langlinkUnsafe: Always set _namespace to a Namespace object
APISite.pagelanglinks creates link objects using Link.langlinkUnsafe. If the links was in the main namespace, Page(link).namespace() was an int object which caused attribute errors.
Fix the docstring of NamespacesDict.__getattr__.
Bug: T203491 Change-Id: Ic2ab6707a88f2980049b92517cb98713f9e6a14e --- M pywikibot/page.py M pywikibot/site.py 2 files changed, 4 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index a249933..126fb95 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -5897,14 +5897,14 @@ link._section = None link._source = source
- link._namespace = 0 - + link._namespace = link._site.namespaces[0] if ':' in title: ns, t = title.split(':', 1) ns = link._site.namespaces.lookup_name(ns) if ns: link._namespace = ns title = t + if u"#" in title: t, sec = title.split(u'#', 1) title, link._section = t.rstrip(), sec.lstrip() diff --git a/pywikibot/site.py b/pywikibot/site.py index d48f808..5ac00c9 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -543,8 +543,8 @@ """ Get the namespace with the given key.
- @param key: namespace key - @type key: Namespace, int or str + @param attr: namespace key + @type attr: Namespace, int or str @rtype: Namespace """ # lookup_name access _namespaces
pywikibot-commits@lists.wikimedia.org