jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/550385 )
Change subject: component: Deriving from tools.UnicodeMixin to BaseLink
......................................................................
component: Deriving from tools.UnicodeMixin to BaseLink
Deleted the __str__ method in BaseLink and the if else
statement differenciating between PY2 and PY3. The
__str__ method is now being derived from UnicodeMixin
and if using PY2 the mixin class encodes to utf-8.
Bug: T223894
Change-Id: I0318ff8c106e340b4d9028a9759af2835e7941fe
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 14 deletions(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5fa4c69..b889df3 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5703,7 +5703,7 @@
return self.__dict__ == other.__dict__
-class BaseLink(ComparableMixin):
+class BaseLink(UnicodeMixin, ComparableMixin):
"""
A MediaWiki link (local or interwiki).
@@ -5865,19 +5865,6 @@
return '[[%s:%s]]' % (self.site.code, title)
return '[[%s:%s:%s]]' % (self.site.family.name, self.site.code, title)
- if not PY2:
- def __str__(self):
- """Return a string representation."""
- return self.__unicode__()
- else: # PY2
- def __str__(self):
- """Return a string representation."""
- return self.__bytes__()
-
- def __bytes__(self):
- """Return a byte representation."""
- return self.astext().encode('ascii', 'backslashreplace')
-
def _cmpkey(self):
"""
Key for comparison of BaseLink objects.
--
To view, visit
https://gerrit.wikimedia.org/r/550385
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0318ff8c106e340b4d9028a9759af2835e7941fe
Gerrit-Change-Number: 550385
Gerrit-PatchSet: 2
Gerrit-Owner: Zack Khalid <zkhalido(a)msudenver.edu>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Welcome, new contributor! <ssethi(a)wikimedia.org>