jenkins-bot has submitted this change and it was merged.
Change subject: page.py: Add string methods to class Revision
......................................................................
page.py: Add string methods to class Revision
Added:
- Revision.__unicode__()
- Revision.__repr__()
Change-Id: Ie0ad1aa6ca30468b288502d12c280e70c20a5420
---
M pywikibot/page.py
1 file changed, 11 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 3d357b8..ecbbe0d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4144,7 +4144,7 @@
}
-class Revision(object):
+class Revision(pywikibot.UnicodeMixin):
"""A structure holding information about a single revision of a
Page."""
@@ -4213,6 +4213,16 @@
"""
return getattr(self, key)
+ def __unicode__(self):
+ """Return string representation."""
+ _content = u', '.join(
+ u'{0}: {1}'.format(k, v) for k, v in self.__dict__.items())
+ return u'{{{0}}}'.format(_content)
+
+ def __repr__(self):
+ """Return a more complete string
representation."""
+ return self.__dict__.__repr__()
+
class FileInfo(pywikibot.UnicodeMixin):
--
To view, visit
https://gerrit.wikimedia.org/r/190349
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0ad1aa6ca30468b288502d12c280e70c20a5420
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>