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
c638a2e9
Commit
c638a2e9
authored
Mar 20, 2011
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opener fixes
parent
929c9603
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
fs/httpfs.py
+5
-1
fs/multifs.py
+5
-8
fs/opener.py
+5
-4
No files found.
fs/httpfs.py
View file @
c638a2e9
...
...
@@ -9,6 +9,7 @@ from fs.base import FS
from
fs.path
import
normpath
from
fs.errors
import
ResourceNotFoundError
,
UnsupportedError
from
urllib2
import
urlopen
,
URLError
from
fs.filelike
import
FileWrapper
class
HTTPFS
(
FS
):
...
...
@@ -20,6 +21,9 @@ class HTTPFS(FS):
"""
_meta
=
{
'read_only'
:
True
,
'network'
:
True
,}
def
__init__
(
self
,
url
):
"""
...
...
@@ -46,7 +50,7 @@ class HTTPFS(FS):
except
OSError
,
e
:
raise
ResourceNotFoundError
(
path
,
details
=
e
)
return
f
return
FileWrapper
(
f
)
def
exists
(
self
,
path
):
return
self
.
isfile
(
path
)
...
...
fs/multifs.py
View file @
c638a2e9
...
...
@@ -62,11 +62,10 @@ you can always access them directly.
"""
from
fs.base
import
FS
,
FSError
,
synchronize
from
fs.base
import
FS
,
synchronize
from
fs.path
import
*
from
fs.errors
import
*
from
fs
import
_thread_synchronize_default
from
fs.errors
import
ResourceNotFoundError
class
MultiFS
(
FS
):
...
...
@@ -234,7 +233,7 @@ class MultiFS(FS):
for
fs
in
self
:
try
:
paths
+=
fs
.
listdir
(
path
,
*
args
,
**
kwargs
)
except
FSError
,
e
:
except
FSError
:
pass
return
list
(
set
(
paths
))
...
...
@@ -254,16 +253,14 @@ class MultiFS(FS):
@synchronize
def
rename
(
self
,
src
,
dst
):
if
self
.
writefs
is
None
:
raise
OperationFailedError
(
'rename'
,
path
=
path
,
msg
=
"No writeable FS set"
)
self
.
writefs
.
rename
(
src
,
dst
)
raise
ResourceNotFoundError
(
path
)
raise
OperationFailedError
(
'rename'
,
path
=
src
,
msg
=
"No writeable FS set"
)
self
.
writefs
.
rename
(
src
,
dst
)
@synchronize
def
settimes
(
self
,
path
,
accessed_time
=
None
,
modified_time
=
None
):
if
self
.
writefs
is
None
:
raise
OperationFailedError
(
'settimes'
,
path
=
path
,
msg
=
"No writeable FS set"
)
self
.
writefs
.
settimes
(
path
,
accessed_time
,
modified_time
)
raise
ResourceNotFoundError
(
path
)
self
.
writefs
.
settimes
(
path
,
accessed_time
,
modified_time
)
@synchronize
def
getinfo
(
self
,
path
):
...
...
fs/opener.py
View file @
c638a2e9
...
...
@@ -231,7 +231,8 @@ class OpenerRegistry(object):
fs_path
=
join
(
fs_path
,
path
)
if
create_dir
and
fs_path
:
fs
.
makedir
(
fs_path
,
allow_recreate
=
True
)
if
not
fs
.
getmeta
(
'read_only'
,
False
):
fs
.
makedir
(
fs_path
,
allow_recreate
=
True
)
pathname
,
resourcename
=
pathsplit
(
fs_path
or
''
)
if
pathname
and
resourcename
:
...
...
@@ -659,7 +660,7 @@ example:
def
get_fs
(
cls
,
registry
,
fs_name
,
fs_name_params
,
fs_path
,
writeable
,
create_dir
):
from
fs.httpfs
import
HTTPFS
if
'/'
in
fs_path
:
dirname
,
resourcename
=
fs_path
.
rsplit
(
'/'
)
dirname
,
resourcename
=
fs_path
.
rsplit
(
'/'
,
1
)
else
:
dirname
=
fs_path
resourcename
=
''
...
...
@@ -796,7 +797,7 @@ example:
mount_fs
=
MountFS
()
for
mount_point
,
mount_path
in
cfg
.
items
(
section
):
mount_fs
.
mount
(
mount_point
,
registry
.
opendir
(
mount_path
))
mount_fs
.
mount
(
mount_point
,
registry
.
opendir
(
mount_path
,
create_dir
=
create_dir
))
return
mount_fs
,
''
...
...
@@ -832,7 +833,7 @@ example:
multi_fs
=
MultiFS
()
for
name
,
fs_url
in
cfg
.
items
(
section
):
multi_fs
.
addfs
(
name
,
registry
.
opendir
(
fs_url
))
multi_fs
.
addfs
(
name
,
registry
.
opendir
(
fs_url
,
create_dir
=
create_dir
))
return
multi_fs
,
''
...
...
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