From 78e7e5230b7162f4668b35850cf07d4fa809a1eb Mon Sep 17 00:00:00 2001 From: digi-ark Date: Sat, 21 Nov 2020 10:14:05 -0500 Subject: [PATCH] python3 supports unicode from __str__ the wikicode can be converted to unicode via "__unicode__" but python3 support unicode through "__str__". This commimt allows python3 code to convert a wikicode into a unicode via str([wikicode]) --- mwparserfromhell/wikicode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mwparserfromhell/wikicode.py b/mwparserfromhell/wikicode.py index f72c26b..45ade9b 100644 --- a/mwparserfromhell/wikicode.py +++ b/mwparserfromhell/wikicode.py @@ -51,6 +51,9 @@ class Wikicode(StringMixIn): def __unicode__(self): return "".join([str(node) for node in self.nodes]) + def __str__(self): + return self.__unicode__() + @staticmethod def _get_children(node, contexts=False, restrict=None, parent=None): """Iterate over all child :class:`.Node`\\ s of a given *node*."""