jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Fix deprecation warning for namespace shortcuts ......................................................................
[bugfix] Fix deprecation warning for namespace shortcuts
namespaces.CONSTANT gives the Namespace object not the string. Assigning Namespace to a string adds a colon and prepends one for FILE and CATEGORY Namespace because Namespace.__str__ uses the canonical_prefix method whereas the old shortcuts gives the default localized name which is custom_name property. The deprecation warning should follow this issue.
Change-Id: Idaa5e28dccbdd0311b617ec8607c4bbc96d88fa7 --- M pywikibot/site.py 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index c421fbf..b8c69ea 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1168,27 +1168,27 @@
# namespace shortcuts for backwards-compatibility
- @deprecated('namespaces.SPECIAL') + @deprecated('namespaces.SPECIAL.custom_name') def special_namespace(self): """Return local name for the Special: namespace.""" return self.namespace(-1)
- @deprecated('namespaces.FILE') + @deprecated('namespaces.FILE.custom_name') def image_namespace(self): """Return local name for the File namespace.""" return self.namespace(6)
- @deprecated('namespaces.MEDIAWIKI') + @deprecated('namespaces.MEDIAWIKI.custom_name') def mediawiki_namespace(self): """Return local name for the MediaWiki namespace.""" return self.namespace(8)
- @deprecated('namespaces.TEMPLATE') + @deprecated('namespaces.TEMPLATE.custom_name') def template_namespace(self): """Return local name for the Template namespace.""" return self.namespace(10)
- @deprecated('namespaces.CATEGORY') + @deprecated('namespaces.CATEGORY.custom_name') def category_namespace(self): """Return local name for the Category namespace.""" return self.namespace(14)
pywikibot-commits@lists.wikimedia.org