avoid repr() on paths in filesystem errors

This commit is contained in:
Adrian Sampson 2014-02-27 19:47:03 -08:00
parent d9435552d3
commit cd7b74271a
2 changed files with 11 additions and 6 deletions

View file

@ -94,16 +94,19 @@ class FilesystemError(HumanReadableException):
def get_message(self):
# Use a nicer English phrasing for some specific verbs.
if self.verb in ('move', 'copy', 'rename'):
clause = 'while {0} {1} to {2}'.format(
self._gerund(), repr(self.paths[0]), repr(self.paths[1])
clause = u'while {0} {1} to {2}'.format(
self._gerund(),
displayable_path(self.paths[0]),
displayable_path(self.paths[1])
)
elif self.verb in ('delete', 'write', 'create', 'read'):
clause = 'while {0} {1}'.format(
self._gerund(), repr(self.paths[0])
clause = u'while {0} {1}'.format(
self._gerund(),
displayable_path(self.paths[0])
)
else:
clause = 'during {0} of paths {1}'.format(
self.verb, u', '.join(repr(p) for p in self.paths)
clause = u'during {0} of paths {1}'.format(
self.verb, u', '.join(displayable_path(p) for p in self.paths)
)
return u'{0} {1}'.format(self._reasonstr(), clause)

View file

@ -6,6 +6,8 @@ Changelog
* Internally, beets has laid the groundwork for supporting multi-valued
fields. Thanks to geigerzaehler.
* Error messages involving paths no longer escape non-ASCII characters (for
legibility).
1.3.3 (February 26, 2014)