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
0288328a
Commit
0288328a
authored
Mar 02, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure max_size is always given to SpooledTemporaryFile
parent
0a8a21cf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
fs/remote.py
+10
-4
No files found.
fs/remote.py
View file @
0288328a
...
@@ -16,7 +16,7 @@ FS subclasses interfacing with a remote filesystem. These include:
...
@@ -16,7 +16,7 @@ FS subclasses interfacing with a remote filesystem. These include:
of a remote FS, and allows client code to wait for
of a remote FS, and allows client code to wait for
a connection to be re-established.
a connection to be re-established.
* CacheFS: a WrapFS subclass that caces file and directory meta-data in
* CacheFS: a WrapFS subclass that cac
h
es file and directory meta-data in
memory, to speed access to a remote FS.
memory, to speed access to a remote FS.
"""
"""
...
@@ -31,9 +31,13 @@ from fs.path import *
...
@@ -31,9 +31,13 @@ from fs.path import *
from
fs.errors
import
*
from
fs.errors
import
*
try
:
try
:
from
tempfile
import
SpooledTemporaryFile
as
TempFile
from
tempfile
import
SpooledTemporaryFile
except
ImportError
:
except
ImportError
:
from
tempfile
import
NamedTemporaryFile
as
TempFile
from
tempfile
import
NamedTemporaryFile
class
SpooledTemporaryFile
(
NamedTemporaryFile
):
def
__init__
(
self
,
max_size
=
0
,
*
args
,
**
kwds
):
NamedTemporaryFile
.
__init__
(
self
,
*
args
,
**
kwds
)
class
RemoteFileBuffer
(
object
):
class
RemoteFileBuffer
(
object
):
...
@@ -62,6 +66,8 @@ class RemoteFileBuffer(object):
...
@@ -62,6 +66,8 @@ class RemoteFileBuffer(object):
the buffer on demand.
the buffer on demand.
"""
"""
max_size_in_memory
=
1024
*
8
def
__init__
(
self
,
fs
,
path
,
mode
,
rfile
=
None
):
def
__init__
(
self
,
fs
,
path
,
mode
,
rfile
=
None
):
"""RemoteFileBuffer constructor.
"""RemoteFileBuffer constructor.
...
@@ -69,7 +75,7 @@ class RemoteFileBuffer(object):
...
@@ -69,7 +75,7 @@ class RemoteFileBuffer(object):
optional argument 'rfile' is provided, it must be a read()-able
optional argument 'rfile' is provided, it must be a read()-able
object or a string containing the initial file contents.
object or a string containing the initial file contents.
"""
"""
self
.
file
=
TempFile
(
)
self
.
file
=
SpooledTemporyFile
(
max_size
=
self
.
max_size_in_memory
)
self
.
fs
=
fs
self
.
fs
=
fs
self
.
path
=
path
self
.
path
=
path
self
.
mode
=
mode
self
.
mode
=
mode
...
...
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