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
623515d4
Commit
623515d4
authored
Jun 16, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unicode encoding for directory listings
parent
3af4d595
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
fs/osfs/__init__.py
+10
-9
No files found.
fs/osfs/__init__.py
View file @
623515d4
...
...
@@ -47,12 +47,12 @@ class OSFS(OSFSXAttrMixin,OSFSWatchMixin,FS):
:param dir_mode: srt
:param thread_synchronize: If True, this object will be thread-safe by use of a threading.Lock object
:param encoding: The encoding method for path strings
:param create: Of True, then root_path will be created (if nec
ce
sary)
:param create: Of True, then root_path will be created (if nec
es
sary)
"""
super
(
OSFS
,
self
)
.
__init__
(
thread_synchronize
=
thread_synchronize
)
self
.
encoding
=
encoding
self
.
encoding
=
encoding
or
sys
.
getfilesystemencoding
()
root_path
=
os
.
path
.
expanduser
(
os
.
path
.
expandvars
(
root_path
))
root_path
=
os
.
path
.
normpath
(
os
.
path
.
abspath
(
root_path
))
# Enable long pathnames on win32
...
...
@@ -79,14 +79,15 @@ class OSFS(OSFSXAttrMixin,OSFSWatchMixin,FS):
def
__unicode__
(
self
):
return
u"<OSFS:
%
s>"
%
self
.
root_path
def
_decode_path
(
self
,
p
):
if
isinstance
(
p
,
unicode
):
return
p
return
p
.
decode
(
self
.
encoding
,
'replace'
)
def
getsyspath
(
self
,
path
,
allow_none
=
False
):
path
=
relpath
(
normpath
(
path
))
.
replace
(
"/"
,
os
.
sep
)
path
=
os
.
path
.
join
(
self
.
root_path
,
path
)
if
not
isinstance
(
path
,
unicode
):
if
self
.
encoding
is
None
:
path
=
path
.
decode
(
sys
.
getfilesystemencoding
())
else
:
path
=
path
.
decode
(
self
.
encoding
)
path
=
os
.
path
.
join
(
self
.
root_path
,
path
)
path
=
self
.
_decode_path
(
path
)
return
path
def
unsyspath
(
self
,
path
):
...
...
@@ -122,7 +123,7 @@ class OSFS(OSFSXAttrMixin,OSFSWatchMixin,FS):
@convert_os_errors
def
listdir
(
self
,
path
=
"./"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
dirs_only
=
False
,
files_only
=
False
):
paths
=
os
.
listdir
(
self
.
getsyspath
(
path
))
paths
=
[
self
.
_decode_path
(
p
)
for
p
in
os
.
listdir
(
self
.
getsyspath
(
path
))]
return
self
.
_listdir_helper
(
path
,
paths
,
wildcard
,
full
,
absolute
,
dirs_only
,
files_only
)
@convert_os_errors
...
...
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