@@ -260,9 +260,9 @@ def writeValue(self, value):
260
260
def writeData (self , data ):
261
261
self .beginElement ("data" )
262
262
self .indentLevel -= 1
263
- maxlinelength = 76 - len (self .indent .replace ("\t " , " " * 8 ) *
263
+ maxlinelength = 76 - len (self .indent .replace (b "\t " , b " " * 8 ) *
264
264
self .indentLevel )
265
- for line in data .asBase64 (maxlinelength ).split ("\n " ):
265
+ for line in data .asBase64 (maxlinelength ).split (b "\n " ):
266
266
if line :
267
267
self .writeln (line )
268
268
self .indentLevel += 1
@@ -368,11 +368,11 @@ def __init__(self, data):
368
368
raise TypeError ("data must be as bytes" )
369
369
self .data = data
370
370
371
+ @classmethod
371
372
def fromBase64 (cls , data ):
372
373
# base64.decodestring just calls binascii.a2b_base64;
373
374
# it seems overkill to use both base64 and binascii.
374
375
return cls (binascii .a2b_base64 (data ))
375
- fromBase64 = classmethod (fromBase64 )
376
376
377
377
def asBase64 (self , maxlinelength = 76 ):
378
378
return _encodeBase64 (self .data , maxlinelength )
@@ -464,6 +464,6 @@ def end_real(self):
464
464
def end_string (self ):
465
465
self .addObject (self .getData ())
466
466
def end_data (self ):
467
- self .addObject (Data .fromBase64 (self .getData ()))
467
+ self .addObject (Data .fromBase64 (self .getData (). encode ( "utf-8" ) ))
468
468
def end_date (self ):
469
469
self .addObject (_dateFromString (self .getData ()))
0 commit comments