Archived logs commit 1. Squash me.
This commit is contained in:
parent
54fbb2a4c0
commit
451e034ca1
9 changed files with 402 additions and 22 deletions
|
@ -58,9 +58,12 @@ class S3Userfiles(object):
|
|||
encrypt_key=True)
|
||||
return (url, file_id)
|
||||
|
||||
def store_file(self, file_like_obj, content_type):
|
||||
def store_file(self, file_like_obj, content_type, file_id=None):
|
||||
self._initialize_s3()
|
||||
file_id = str(uuid4())
|
||||
|
||||
if file_id is None:
|
||||
file_id = str(uuid4())
|
||||
|
||||
full_key = os.path.join(self._prefix, file_id)
|
||||
k = Key(self._bucket, full_key)
|
||||
logger.debug('Setting s3 content type to: %s' % content_type)
|
||||
|
@ -161,8 +164,9 @@ class LocalUserfiles(object):
|
|||
except IOError:
|
||||
break
|
||||
|
||||
def store_file(self, file_like_obj, content_type):
|
||||
file_id = str(uuid4())
|
||||
def store_file(self, file_like_obj, content_type, file_id=None):
|
||||
if file_id is None:
|
||||
file_id = str(uuid4())
|
||||
|
||||
# Rewind the file to match what s3 does
|
||||
file_like_obj.seek(0, os.SEEK_SET)
|
||||
|
|
Reference in a new issue