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
1e276505
Commit
1e276505
authored
Sep 29, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workaround seek() bug in SpooledTemporaryFile
parent
2341a9f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
fs/remote.py
+16
-0
No files found.
fs/remote.py
View file @
1e276505
...
...
@@ -21,6 +21,7 @@ FS subclasses interfacing with a remote filesystem. These include:
"""
import
os
import
time
import
copy
...
...
@@ -134,6 +135,21 @@ class RemoteFileBuffer(object):
def
__iter__
(
self
):
return
iter
(
self
.
file
)
def
seek
(
self
,
offset
,
whence
=
os
.
SEEK_SET
):
if
isinstance
(
self
.
file
,
SpooledTemporaryFile
):
# SpooledTemporaryFile.seek doesn't roll to disk if seeking
# beyond the max in-memory size.
if
whence
==
os
.
SEEK_SET
:
if
offset
>
self
.
file
.
_max_size
:
self
.
file
.
rollover
()
elif
whence
==
os
.
SEEK_CUR
:
if
offset
+
self
.
file
.
tell
()
>
self
.
file
.
_max_size
:
self
.
file
.
rollover
()
else
:
if
offset
>
0
:
self
.
file
.
rollover
()
self
.
file
.
seek
(
offset
,
whence
)
def
truncate
(
self
,
size
=
None
):
self
.
_lock
.
acquire
()
try
:
...
...
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