tolerate a str arg to writeData()

This commit is contained in:
Damien Elmes 2013-10-09 13:13:48 +09:00
parent d503b62cd1
commit 2d4e88afbd

View File

@ -89,6 +89,10 @@ class MediaManager(object):
return self.writeData(opath, open(opath, "rb").read())
def writeData(self, opath, data):
if not isinstance(opath, unicode):
# old code/addons were passing as str
print "writeData() should be called with unicode"
opath = unicode(opath, "utf8", "ignore")
# if fname is a full path, use only the basename
fname = os.path.basename(opath)
# make sure we write it in NFC form (on mac will autoconvert to NFD),