* fix: use StringIO to make autoxml.__str__ return a string properly
This commit is contained in:
+8
-1
@@ -39,6 +39,7 @@ import codecs
|
|||||||
import types
|
import types
|
||||||
import formatter
|
import formatter
|
||||||
import sys
|
import sys
|
||||||
|
from StringIO import StringIO
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
@@ -330,7 +331,13 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
ctx.ui.warning(x)
|
ctx.ui.warning(x)
|
||||||
cls.print_text = print_text
|
cls.print_text = print_text
|
||||||
if not dict.has_key('__str__'):
|
if not dict.has_key('__str__'):
|
||||||
cls.__str__ = print_text
|
def str(self):
|
||||||
|
strfile = StringIO()
|
||||||
|
self.print_text(strfile)
|
||||||
|
str = strfile.getvalue()
|
||||||
|
strfile.close()
|
||||||
|
return str
|
||||||
|
cls.__str__ = str
|
||||||
|
|
||||||
if not dict.has_key('__eq__'):
|
if not dict.has_key('__eq__'):
|
||||||
def equal(self, other):
|
def equal(self, other):
|
||||||
|
|||||||
Reference in New Issue
Block a user