jenkins-bot has submitted this change and it was merged.
Change subject: Add Namespace.__int__ to cast to integer
......................................................................
Add Namespace.__int__ to cast to integer
Format strings use %d and %i for page.namespace(), which is now
a Namespace. Allow the Namespace to be cast as an int.
Change-Id: Ice3d1fca94f431023f10d2e1999b0b49e0b2cd02
---
M pywikibot/site.py
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 75bbbd1..ba1b00c 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -296,6 +296,9 @@
"""Return the custom name with required colons."""
return Namespace._colons(self.id, self.custom_name)
+ def __int__(self):
+ return self.id
+
def __index__(self):
return self.id
--
To view, visit https://gerrit.wikimedia.org/r/172108
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ice3d1fca94f431023f10d2e1999b0b49e0b2cd02
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits