def _get_image_instance(field_storage):
    bucket_name = Config.get('BUCKET_NAME')
    file_instance = File()
    file_instance.kind = IMAGE
    file_instance.name = field_storage.filename
    file_instance.size = field_storage.bufsize
    file_instance.link = 'https://s3-sa-east-1.amazonaws.com/%s/%s' % (bucket_name, field_storage.filename)
    return file_instance
Beispiel #2
0
def _get_file_to_dict_json(layer_id):
    file_inst = File.get_by_id(int(layer_id))

    if file_inst is None:
        raise MSException('FileId invalido')

    return file_inst.to_dict_json()
Beispiel #3
0
def _get_image_instance(field_storage):
    bucket_name = Config.get('BUCKET_NAME')
    file_instance = File()
    file_instance.kind = IMAGE
    file_instance.name = field_storage.filename
    file_instance.size = field_storage.bufsize
    file_instance.link = 'https://s3-sa-east-1.amazonaws.com/%s/%s' % (
        bucket_name, field_storage.filename)
    return file_instance
Beispiel #4
0
def _delete_files(layer):
    files = File.query(File.layer == layer.key).fetch()
    files_tdj = delete_file_svc.delete(files)
    return files_tdj['files']
def _list_files(layer_id):
    files = File.query(File.layer == ndb.Key(Layer, layer_id)).fetch()
    files_tdj = [f.to_dict_json() for f in files]
    return files_tdj
def _list_files(layer_id):
    files = File.query(File.layer == ndb.Key(Layer, layer_id)).fetch()
    files_tdj = [f.to_dict_json() for f in files]
    return files_tdj