Hack to make thumbnails of size t public
This should be fixed as soon as possible, by making the push_to_storage function data-aware.
This commit is contained in:
parent
eb92d179e8
commit
b149a5b3ed
@ -91,6 +91,12 @@ def build_thumbnails(file_path=None, file_id=None):
|
|||||||
md5=thumbnail['md5'],
|
md5=thumbnail['md5'],
|
||||||
file_path=basename,
|
file_path=basename,
|
||||||
)
|
)
|
||||||
|
# XXX Inject is_public for size 't' (should be part of the upload),
|
||||||
|
# and currently we set it here and then on the fly during blob
|
||||||
|
# creation by simply parsing the extension of the filename. This is
|
||||||
|
# bad.
|
||||||
|
if size == 't':
|
||||||
|
file_variation['is_public'] = True
|
||||||
|
|
||||||
file_variations.append(file_variation)
|
file_variations.append(file_variation)
|
||||||
|
|
||||||
|
@ -65,7 +65,12 @@ def push_to_storage(project_id, full_path, backend='cgs'):
|
|||||||
def push_single_file(project_id, full_path, backend):
|
def push_single_file(project_id, full_path, backend):
|
||||||
if backend == 'cgs':
|
if backend == 'cgs':
|
||||||
storage = GoogleCloudStorageBucket(project_id, subdir='_')
|
storage = GoogleCloudStorageBucket(project_id, subdir='_')
|
||||||
storage.Post(full_path)
|
blob = storage.Post(full_path)
|
||||||
|
# XXX Make public on the fly if it's an image and small preview.
|
||||||
|
# This should happen by reading the database (push to storage
|
||||||
|
# should change to accomodate it).
|
||||||
|
if full_path.endswith('-t.jpg'):
|
||||||
|
blob.make_public()
|
||||||
os.remove(full_path)
|
os.remove(full_path)
|
||||||
|
|
||||||
if os.path.isfile(full_path):
|
if os.path.isfile(full_path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user