Move the upload flag to the database, and use the database stored image size rather than going to s3.
This commit is contained in:
parent
21304a5678
commit
ef9fe871fc
7 changed files with 35 additions and 36 deletions
|
@ -92,6 +92,3 @@ class BaseStorage(object):
|
|||
|
||||
def remove(self, path):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_size(self, path):
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -80,7 +80,3 @@ class LocalStorage(BaseStorage):
|
|||
os.remove(path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def get_size(self, path):
|
||||
path = self._init_path(path)
|
||||
return os.path.getsize(path)
|
||||
|
|
|
@ -171,12 +171,3 @@ class S3Storage(BaseStorage):
|
|||
path += '/'
|
||||
for key in self._s3_bucket.list(prefix=path):
|
||||
key.delete()
|
||||
|
||||
def get_size(self, path):
|
||||
self._initialize_s3()
|
||||
path = self._init_path(path)
|
||||
# Lookup does a HEAD HTTP Request on the object
|
||||
key = self._s3_bucket.lookup(path)
|
||||
if not key:
|
||||
raise OSError('No such key: \'{0}\''.format(path))
|
||||
return key.size
|
||||
|
|
Reference in a new issue