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
571b9a3e
Commit
571b9a3e
authored
Oct 05, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LazyFS: custom __unicode__() and __str__()
parent
b182e75e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
fs/wrapfs/lazyfs.py
+13
-0
No files found.
fs/wrapfs/lazyfs.py
View file @
571b9a3e
...
...
@@ -9,6 +9,8 @@ initialise its underlying FS object.
"""
import
sys
try
:
from
threading
import
Lock
except
ImportError
:
...
...
@@ -30,6 +32,17 @@ class LazyFS(WrapFS):
super
(
LazyFS
,
self
)
.
__init__
(
fs
)
self
.
_lazy_creation_lock
=
Lock
()
def
__unicode__
(
self
):
try
:
wrapped_fs
=
self
.
__dict__
[
"wrapped_fs"
]
except
KeyError
:
return
u"<LazyFS wrapping
%
s>"
%
(
self
.
_fsclass
,)
else
:
return
u"<LazyFS wrapping
%
s>"
%
(
wrapped_fs
,)
def
__str__
(
self
):
return
unicode
(
self
)
.
encode
(
sys
.
getdefaultencoding
(),
"replace"
)
def
__getstate__
(
self
):
state
=
super
(
LazyFS
,
self
)
.
__getstate__
()
del
state
[
"_lazy_creation_lock"
]
...
...
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