John Vandenberg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172108
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(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/08/172108/1
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: newchange
Gerrit-Change-Id: Ice3d1fca94f431023f10d2e1999b0b49e0b2cd02
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits