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
c71332a7
Commit
c71332a7
authored
Oct 12, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly handle non-seekable filelikes passed into setcontents
parent
43958384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
fs/s3fs.py
+11
-0
No files found.
fs/s3fs.py
View file @
c71332a7
...
@@ -9,6 +9,7 @@ interface for objects stored in Amazon Simple Storage Service (S3).
...
@@ -9,6 +9,7 @@ interface for objects stored in Amazon Simple Storage Service (S3).
import
time
import
time
import
datetime
import
datetime
import
tempfile
import
stat
as
statinfo
import
stat
as
statinfo
import
boto.s3.connection
import
boto.s3.connection
...
@@ -168,6 +169,16 @@ class S3FS(FS):
...
@@ -168,6 +169,16 @@ class S3FS(FS):
if
isinstance
(
contents
,
basestring
):
if
isinstance
(
contents
,
basestring
):
key
.
set_contents_from_string
(
contents
)
key
.
set_contents_from_string
(
contents
)
else
:
else
:
try
:
contents
.
seek
(
0
)
except
(
AttributeError
,
EnvironmentError
):
tf
=
tempfile
.
TemporaryFile
()
data
=
contents
.
read
(
524288
)
while
data
:
tf
.
write
(
data
)
data
=
contents
.
read
(
524288
)
tf
.
seek
(
0
)
contents
=
tf
key
.
set_contents_from_file
(
contents
)
key
.
set_contents_from_file
(
contents
)
return
self
.
_sync_key
(
key
)
return
self
.
_sync_key
(
key
)
...
...
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