コード例 #1
0
ファイル: home.py プロジェクト: faahbih/projetoolivarts
def index(_logged_user):
    """
    This is a example of file upload using
    Google Cloud Storage
    :return:
    """
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    logging.info(bucket)
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)
    cmd = blob_facade.list_blob_files_cmd(_logged_user)
    blob_form = blob_facade.blob_file_form()
    deletar_path_base = router.to_path(delete)
    download_path_base = router.to_path(download)

    def localizar_blob(blob):
        dct = blob_form.fill_with_model(blob, 64)
        dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
        dct['download_path'] = router.to_path(download_path_base, blob_key=blob.blob_key, filename=dct['filename'])
        return dct

    blob_files = [localizar_blob(b) for b in cmd()]
    context = {'upload_url': url,
               'blob_files': blob_files}
    return TemplateResponse(context, 'updown/home.html')
コード例 #2
0
ファイル: updown.py プロジェクト: beatorizu/tekton
def listImages():  #usar para listar os arquivos de mp3 e gif dos cards ^^
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    return arquivos
コード例 #3
0
def index(_logged_user):
    """
    This is a example of file upload using
    Google Cloud Storage
    :return:
    """
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    logging.info(bucket)
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)
    cmd = blob_facade.list_blob_files_cmd(_logged_user)
    blob_form = blob_facade.blob_file_form()
    deletar_path_base = router.to_path(delete)
    download_path_base = router.to_path(download)

    def localizar_blob(blob):
        dct = blob_form.fill_with_model(blob, 64)
        dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
        dct['download_path'] = router.to_path(download_path_base,
                                              blob_key=blob.blob_key,
                                              filename=dct['filename'])
        return dct

    blob_files = [localizar_blob(b) for b in cmd()]
    context = {'upload_url': url, 'blob_files': blob_files}
    return TemplateResponse(context, 'updown/home.html')
コード例 #4
0
ファイル: updown.py プロジェクト: joaocarlos1994/tekton
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path=to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx, template_path="/updown_home.html")
コード例 #5
0
ファイル: home.py プロジェクト: iwilliam317/tekton
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    for arq in arquivos:
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx)
コード例 #6
0
 def test_upload(self):
     handler = Mock()
     blob_key = self.save_blob('dados')
     blob_info = BlobInfo.get(blob_key)
     handler.get_uploads = lambda k: [blob_info]
     user = mommy.save_one(MainUser)
     upload.index(handler, user, None)
     blob_files = blob_facade.list_blob_files_cmd(user)()
     self.assertEqual(1, len(blob_files))
     self.assertEqual(blob_key, blob_files[0].blob_key)
コード例 #7
0
def index():

    categoria_query = Categoria.query_ordenada_por_nome()
    produto_query = Produto.query_ordenada_por_nome()

    categorias = categoria_query.fetch()
    produtos = produto_query.fetch()



    for cat in categorias:
        cat_key = cat.key
        cat_key_id = cat_key.id()

        cat.QtdProd = len(Produto.query_por_categoria_ordenada_por_nome(Categoria.get_by_id(int(cat_key_id))).fetch())

    for prod in produtos:
        prod_key = prod.key
        prod_key_id = prod_key.id()




    # Angular
    salvar_path = router.to_path(salvarCategoria)   #Agora que está sendo utilizado o angular, o path foi para um arquivo diferente, pois nele há json

    listar_path = router.to_path(listarCategoria)

    deletar_path = router.to_path(deletarCategoria)

    editar_path = router.to_path(editarCategoria)






    upload_path = router.to_path(updown.upload)
    bucket = get_default_gcs_bucket_name()
    url = blobstore.create_upload_url(upload_path, gs_bucket_name=bucket)



    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path= router.to_path(updown.download)
    for arq in arquivos:
        arq.download_path=router.to_path(download_path,arq.key.id(),arq.filename)


    contexto = {'categoria_lista':categorias,'upload_path':url,'arquivos':arquivos,
                'rest_salvar_path':salvar_path,'rest_list_path':listar_path,
                'rest_delete_path':deletar_path,'rest_edit_path':editar_path}

    return TemplateResponse(contexto,template_path='/andris/admin.html')
コード例 #8
0
ファイル: updown.py プロジェクト: priscilamelosilva/Membros
def index():
    comando = blob_facade.list_blob_files_cmd()
    arquivos = comando()
    download_path = to_path(download)
    delete_path = router.to_path(delete)
    for arq in arquivos:
        arq.delete_path = router.to_path(delete_path, arq.key.id(),
                                         arq.filename)
        arq.download_path = to_path(download_path, arq.key.id(), arq.filename)
    ctx = {'arquivos': arquivos}
    return TemplateResponse(ctx, 'updown_home.html')
コード例 #9
0
def index(_handler):
    com= blob_facade.list_blob_files_cmd()
    archives=com()
    download_path= router.to_path(download)
    delete_path = router.to_path(delete)

    for arc in archives:
        arc.delete_path = router.to_path(delete_path, arc.key.id(), arc.filename)
        arc.download_path= router.to_path(download_path, arc.key.id(), arc.filename)

    upload_path = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    url = blobstore.create_upload_url(upload_path, gs_bucket_name=bucket)
    ctx = {'save_path': url, 'archives':archives}
    return TemplateResponse(ctx, '/admin/reports-management.html')
コード例 #10
0
def index(_handler):
    com = blob_facade.list_blob_files_cmd()
    archives = com()
    download_path = router.to_path(download)
    delete_path = router.to_path(delete)

    for arc in archives:
        arc.delete_path = router.to_path(delete_path, arc.key.id(),
                                         arc.filename)
        arc.download_path = router.to_path(download_path, arc.key.id(),
                                           arc.filename)

    upload_path = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    url = blobstore.create_upload_url(upload_path, gs_bucket_name=bucket)
    ctx = {'save_path': url, 'archives': archives}
    return TemplateResponse(ctx, '/admin/reports-management.html')
コード例 #11
0
ファイル: home.py プロジェクト: SamaraCardoso27/eMakeup
def index():
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    logging.info(bucket)
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)
    cmd = blob_facade.list_blob_files_cmd()
    blob_form = blob_facade.blob_file_form()
    deletar_path_base = router.to_path(delete)
    download_path_base = router.to_path(download)

    def localizar_blob(blob):
        dct = blob_form.fill_with_model(blob, 64)
        dct['delete_path'] = router.to_path(deletar_path_base, dct['id'])
        dct['download_path'] = router.to_path(download_path_base, blob.blob_key, dct['filename'].encode('utf8'))
        return dct

    blob_files = [localizar_blob(b) for b in cmd()]
    context = {'upload_url': url,
               'blob_files': blob_files}
    return TemplateResponse(context, 'updown/home.html')
コード例 #12
0
ファイル: home.py プロジェクト: renzon/appengineepython
def index(_logged_user):
    success_url = router.to_path(upload)
    bucket = get_default_gcs_bucket_name()
    url = blobstore.create_upload_url(success_url, gs_bucket_name=bucket)

    cmd = blob_facade.list_blob_files_cmd(_logged_user)
    blob_files = cmd()
    delete_path = router.to_path(delete)
    download_path = router.to_path(download)
    blob_file_form = blob_facade.blob_file_form()

    def localize_blob_file(blob_file):
        blob_file_dct = blob_file_form.fill_with_model(blob_file, 64)
        blob_file_dct['delete_path'] = router.to_path(delete_path, blob_file_dct['id'])
        blob_file_dct['download_path'] = router.to_path(download_path,
                                                        blob_file.blob_key,
                                                        blob_file_dct['filename'])
        return blob_file_dct

    localized_blob_files = [localize_blob_file(blob_file) for blob_file in blob_files]
    context = {'upload_url': url,
               'blob_files': localized_blob_files}
    return TemplateResponse(context, 'updown/home.html')