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
eef6b392
Commit
eef6b392
authored
Sep 19, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for zipfs and copydir
parent
068e7dcf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
fs/base.py
+6
-6
fs/zipfs.py
+6
-2
No files found.
fs/base.py
View file @
eef6b392
...
...
@@ -569,7 +569,7 @@ class FS(object):
if
dst_file
is
not
None
:
dst_file
.
close
()
def
move
(
self
,
src
,
dst
):
def
move
(
self
,
src
,
dst
,
chunk_size
=
16384
):
"""Moves a file from one location to another.
...
...
@@ -586,11 +586,11 @@ class FS(object):
raise
ResourceInvalid
(
"WRONG_TYPE"
,
src
,
msg
=
"Source is not a file:
%(path)
s"
)
shutil
.
move
(
src_syspath
,
dst_syspath
)
else
:
self
.
copy
(
src
,
dst
)
self
.
copy
(
src
,
dst
,
chunk_size
=
chunk_size
)
self
.
remove
(
src
)
def
movedir
(
self
,
src
,
dst
,
ignore_errors
=
False
):
def
movedir
(
self
,
src
,
dst
,
ignore_errors
=
False
,
chunk_size
=
16384
):
"""Moves a directory from one location to another.
...
...
@@ -632,13 +632,13 @@ class FS(object):
src_filename
=
pathjoin
(
dirname
,
filename
)
dst_filename
=
pathjoin
(
dst_dirpath
,
filename
)
movefile
(
src_filename
,
dst_filename
)
movefile
(
src_filename
,
dst_filename
,
chunk_size
=
chunk_size
)
self
.
removedir
(
dirname
)
def
copydir
(
self
,
src
,
dst
,
ignore_errors
=
False
):
def
copydir
(
self
,
src
,
dst
,
ignore_errors
=
False
,
chunk_size
=
16384
):
"""Copies a directory from one location to another.
...
...
@@ -674,7 +674,7 @@ class FS(object):
src_filename
=
pathjoin
(
dirname
,
filename
)
dst_filename
=
pathjoin
(
dst_dirpath
,
filename
)
copyfile
(
src_filename
,
dst_filename
)
copyfile
(
src_filename
,
dst_filename
,
chunk_size
=
chunk_size
)
def
isdirempty
(
self
,
path
):
...
...
fs/zipfs.py
View file @
eef6b392
...
...
@@ -72,7 +72,10 @@ class ZipFS(FS):
raise
ValueError
(
"mode must be 'r', 'w' or 'a'"
)
self
.
zip_mode
=
mode
self
.
zf
=
ZipFile
(
zip_file
,
mode
,
compression_type
,
allowZip64
)
try
:
self
.
zf
=
ZipFile
(
zip_file
,
mode
,
compression_type
,
allowZip64
)
except
IOError
:
raise
ResourceNotFoundError
(
"NO_FILE"
,
"Zip file does not exist:
%(path)
s"
)
self
.
zip_path
=
str
(
zip_file
)
self
.
temp_fs
=
None
...
...
@@ -96,7 +99,8 @@ class ZipFS(FS):
def
_add_resource
(
self
,
path
):
if
path
.
endswith
(
'/'
):
path
=
path
[:
-
1
]
self
.
_path_fs
.
makedir
(
path
,
recursive
=
True
,
allow_recreate
=
True
)
if
path
:
self
.
_path_fs
.
makedir
(
path
,
recursive
=
True
,
allow_recreate
=
True
)
else
:
dirpath
,
filename
=
pathsplit
(
path
)
if
dirpath
:
...
...
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