Commit 7f18108a by rfkelly0

better handling of unicode paths in errors

parent 07d00c02
......@@ -31,7 +31,12 @@ class FSError(Exception):
self.details = details
def __str__(self):
return unicode(self).encode(sys.getfilesystemencoding())
keys = {}
for k,v in self.__dict__.iteritems():
if isinstance(v,unicode):
v = v.encode(sys.getfilesystemencoding())
keys[k] = v
return str(self.msg % keys)
def __unicode__(self):
keys = dict((k,v) for k,v in self.__dict__.iteritems())
......
......@@ -252,7 +252,7 @@ def wrap_fs_methods(decorator,cls=None,exclude=[]):
methods = ("open","exists","isdir","isfile","listdir","makedir","remove",
"setcontents","removedir","rename","getinfo","copy","move",
"copydir","movedir","close","getxattr","setxattr","delxattr",
"listxattrs")
"listxattrs","getsyspath")
def apply_decorator(cls):
for method_name in methods:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment