Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
ef97c07e
Commit
ef97c07e
authored
Sep 10, 2013
by
willmcgugan@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow unicode conversion for errors containing non-ascii strings.
parent
6829f99a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
fs/errors.py
+7
-1
fs/tests/test_errors.py
+7
-0
No files found.
fs/errors.py
View file @
ef97c07e
...
@@ -39,6 +39,7 @@ __all__ = ['FSError',
...
@@ -39,6 +39,7 @@ __all__ = ['FSError',
import
sys
import
sys
import
errno
import
errno
import
six
from
fs.path
import
*
from
fs.path
import
*
from
fs.local_functools
import
wraps
from
fs.local_functools
import
wraps
...
@@ -63,7 +64,12 @@ class FSError(Exception):
...
@@ -63,7 +64,12 @@ class FSError(Exception):
return
str
(
self
.
msg
%
keys
)
return
str
(
self
.
msg
%
keys
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
unicode
(
self
.
msg
)
%
self
.
__dict__
keys
=
{}
for
k
,
v
in
self
.
__dict__
.
iteritems
():
if
isinstance
(
v
,
six
.
binary_type
):
v
=
v
.
decode
(
sys
.
getfilesystemencoding
(),
errors
=
'replace'
)
keys
[
k
]
=
v
return
unicode
(
self
.
msg
,
encoding
=
sys
.
getfilesystemencoding
(),
errors
=
'replace'
)
%
keys
def
__reduce__
(
self
):
def
__reduce__
(
self
):
return
(
self
.
__class__
,(),
self
.
__dict__
.
copy
(),)
return
(
self
.
__class__
,(),
self
.
__dict__
.
copy
(),)
...
...
fs/tests/test_errors.py
View file @
ef97c07e
# -*- encoding: utf-8 -*-
"""
"""
fs.tests.test_errors: testcases for the fs error classes functions
fs.tests.test_errors: testcases for the fs error classes functions
...
@@ -24,3 +25,8 @@ class TestErrorPickling(unittest.TestCase):
...
@@ -24,3 +25,8 @@ class TestErrorPickling(unittest.TestCase):
assert_dump_load
(
UnsupportedError
(
"makepony"
))
assert_dump_load
(
UnsupportedError
(
"makepony"
))
class
TestFSError
(
unittest
.
TestCase
):
def
test_unicode_representation_of_error_with_non_ascii_characters
(
self
):
path_error
=
PathError
(
'/Shïrê/Frødø'
)
_
=
unicode
(
path_error
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment