summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-31 14:18:20 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-31 14:18:20 (GMT)
commitba25c8991934c29bde4d1e5f8c45521414300b4f (patch)
treeaca828c0e1f041bb97e9c871bc73baebaa7e7056 /Lib/plat-mac
parent261f9df18dce95075c6176da0cf3d6fd98ef45a4 (diff)
downloadcpython-ba25c8991934c29bde4d1e5f8c45521414300b4f.zip
cpython-ba25c8991934c29bde4d1e5f8c45521414300b4f.tar.gz
cpython-ba25c8991934c29bde4d1e5f8c45521414300b4f.tar.bz2
Got test_plistlib working. Don't ask how.
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r--Lib/plat-mac/plistlib.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/plat-mac/plistlib.py b/Lib/plat-mac/plistlib.py
index 2a7957e..e0e01ff 100644
--- a/Lib/plat-mac/plistlib.py
+++ b/Lib/plat-mac/plistlib.py
@@ -260,9 +260,9 @@ class PlistWriter(DumbXMLWriter):
def writeData(self, data):
self.beginElement("data")
self.indentLevel -= 1
- maxlinelength = 76 - len(self.indent.replace("\t", " " * 8) *
+ maxlinelength = 76 - len(self.indent.replace(b"\t", b" " * 8) *
self.indentLevel)
- for line in data.asBase64(maxlinelength).split("\n"):
+ for line in data.asBase64(maxlinelength).split(b"\n"):
if line:
self.writeln(line)
self.indentLevel += 1
@@ -368,11 +368,11 @@ class Data:
raise TypeError("data must be as bytes")
self.data = data
+ @classmethod
def fromBase64(cls, data):
# base64.decodestring just calls binascii.a2b_base64;
# it seems overkill to use both base64 and binascii.
return cls(binascii.a2b_base64(data))
- fromBase64 = classmethod(fromBase64)
def asBase64(self, maxlinelength=76):
return _encodeBase64(self.data, maxlinelength)
@@ -464,6 +464,6 @@ class PlistParser:
def end_string(self):
self.addObject(self.getData())
def end_data(self):
- self.addObject(Data.fromBase64(self.getData()))
+ self.addObject(Data.fromBase64(self.getData().encode("utf-8")))
def end_date(self):
self.addObject(_dateFromString(self.getData()))