jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Handle namespace in a language-agnositc way in titletranslate.py ......................................................................
[FIX] Handle namespace in a language-agnositc way in titletranslate.py
Bug: T75934 Change-Id: I642cb7602e5717492f94990a57ebde540b6ae8b5 --- M pywikibot/titletranslate.py 1 file changed, 5 insertions(+), 8 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/titletranslate.py b/pywikibot/titletranslate.py index 5b86032..5735163 100644 --- a/pywikibot/titletranslate.py +++ b/pywikibot/titletranslate.py @@ -50,13 +50,7 @@ # we're currently working on ... if page is None: continue - ns = page.namespace() - if ns: - newname = u'%s:%s' % (site.namespace(ns), - page.title(withNamespace=False)) - else: - # article in the main namespace - newname = page.title() + newname = page.title(withNamespace=False) # ... unless we do want brackets if removebrackets: newname = re.sub(re.compile(r"\W*?(.*?)\W*?", @@ -72,9 +66,12 @@ else: codes = codes.split(',') for newcode in codes: + if newcode in site.languages(): if newcode != site.code: - x = pywikibot.Link(newname, site.getSite(code=newcode)) + x = pywikibot.Link(newname, + site.getSite(code=newcode), + defaultNamespace=page.namespace()) result.add(x) else: if config.verbose_output:
pywikibot-commits@lists.wikimedia.org