本文整理汇总了Python中tekton.router.to_path函数的典型用法代码示例。如果您正苦于以下问题:Python to_path函数的具体用法?Python to_path怎么用?Python to_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了to_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
def index(_write_tmpl, ret_path='/'):
g_path = router.to_path(google.index, ret_path=ret_path)
dct = {'login_google_path': users.create_login_url(g_path),
'login_passwordless_path': router.to_path(enviar_email,ret_path=ret_path),
'login_facebook_path': router.to_path(facebook.index,ret_path=ret_path),
'faceapp': facade.get_facebook_app_data().execute().result}
_write_tmpl('login/home.html', dct)
示例2: index
def index(_logged_user):
if not _logged_user.email == '[email protected]':
return RedirectResponse('/erro')
return TemplateResponse({'security_table_path': router.to_path(permission_home.index),
'permission_admin_path': router.to_path(admin),
'passwordless_admin_path': router.to_path(passwordless.form),
'facebook_admin_path': router.to_path(facebook.form)})
示例3: index
def index(ret_path='/'):
g_path = router.to_path(google.index, ret_path=ret_path)
dct = {'login_google_path': users.create_login_url(g_path),
'login_passwordless_path': router.to_path(send_email, ret_path=ret_path),
'login_facebook_path': router.to_path(facebook.index, ret_path=ret_path),
'faceapp': facade.get_facebook_app_data().execute().result}
return TemplateResponse(dct, 'login/home.html')
示例4: index
def index(_write_tmpl, _usuario_corrente):
salvar_path = router.to_path(salvar)
query = Curso.query_encontrar_cursos_de_usuario(_usuario_corrente.key)
cursos = query.fetch()
for c in cursos:
c.detalhar_path = router.to_path(detalhar, c.key.id())
_write_tmpl('curso_home.html', {'cursos': cursos, 'salvar_path': salvar_path})
示例5: index
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')
示例6: index
def index(_write_tmpl):
query = Curso.query_ordenada_por_nome()
cursos = query.fetch()
dct = {'lista_cursos': cursos,
'matricula_url': router.to_path(matricula),
'salvar_url': router.to_path(salvar)}
_write_tmpl('/templates/curso_home.html', dct)
示例7: test_querystring
def test_querystring(self):
query_string = {'foo': 'bar'}
self.assertEqual("/pack?foo=bar", router.to_path(pack, **query_string))
query_string = {'foo': 'bar', 'param': 1}
self.assertEqual("/pack?foo=bar¶m=1", router.to_path(pack, **query_string))
query_string = {'foo': 'çáê', 'param': 1}
self.assertEqual("/pack?foo=%C3%A7%C3%A1%C3%AA¶m=1", router.to_path(pack, **query_string))
示例8: busca_produtos
def busca_produtos(_logged_user, busca):
cmd = facade.list_observacoes_cmd()
observacoes = cmd()
busca = slugify(busca)
pesquisa = Observacoe.query(Observacoe.busca >= busca).order(Observacoe.busca)
get_dono_cmd_lista=[GetDonoObs(o) for o in observacoes]
paralelo=CommandParallel(*get_dono_cmd_lista)
paralelo()
edit_path = router.to_path(edit)
delete_path = router.to_path(delete)
short_form = facade.observacoe_short_form()
def short_observacoe_dict(observacoe):
observacoe_dct = short_form.fill_with_model(observacoe)
observacoe_dct['edit_path'] = router.to_path(edit_path, observacoe_dct['id'])
observacoe_dct['delete_path'] = router.to_path(delete_path, observacoe_dct['id'])
return observacoe_dct
short_observacoes = [short_observacoe_dict(observacoe) for observacoe in observacoes]
for observacao,dono_comando in zip(short_observacoes,get_dono_cmd_lista):
observacao['dono_flag']=(dono_comando.result ==_logged_user)
context = {'observacoe': short_observacoes,
'new_path': router.to_path(new),
'observacoes': pesquisa.fetch()
}
return TemplateResponse(context, router.to_path('observacoes/admin/home.html'))
示例9: index
def index(_logged_user, _handler, **catequizando_properties):
access_denid = validate_permission(COORDENADOR, _logged_user)
if access_denid:
return access_denid
if catequizando_properties.get("files"):
blob_infos = _handler.get_uploads("files[]")
blob_key = blob_infos[0].key()
avatar = to_path(download, blob_key)
catequizando_properties["avatar"] = avatar
catequizando_properties.pop("files", None)
cmd = catequizando_facade.save_catequizando_cmd(**catequizando_properties)
user_not_unique = False
try:
if catequizando_properties.get('username') and User.is_unique(catequizando_properties.get('username')):
cmd()
else:
user_not_unique = True
except CommandExecutionException:
context = {'errors': cmd.errors,
'catechized': catequizando_properties}
return TemplateResponse(context, '/catequizandos/catequizando.html')
if user_not_unique:
cmd.errors['username'] = unicode(u'Usuário já existe.')
context = {'errors': cmd.errors,
'catechized': catequizando_properties}
return TemplateResponse(context, '/catequizandos/catequizando.html')
sleep(0.5)
return RedirectResponse(router.to_path(catequizandos))
示例10: to_dict
def to_dict(self):
dct = super(Participante, self)._to_dict()
id = self.key.id()
dct['id'] = id
dct['deletarPath'] = router.to_path(deletar, id)
dct['editarPath'] = router.to_path(editar, id)
return dct
示例11: localize_blob_file
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
示例12: index
def index():
context = {
'salvar_path': router.to_path(rest.save),
'deletar_path': router.to_path(rest.delete),
'editar_path': router.to_path(rest.update),
'listar_path': router.to_path(rest.index)}
return TemplateResponse(context)
示例13: index
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")
示例14: index
def index():
context = {
'admin_path': router.to_path(admin),
'salvar_path': router.to_path(rest.save),
'editar_path': router.to_path(rest.update),
'apagar_path': router.to_path(rest.delete),
'listar_path': router.to_path(rest.index)}
return TemplateResponse(context, 'books/home.html')
示例15: logar
def logar(_handler, _resp, username, passwd):
found = User.get_by_username_and_pw(username.strip(), passwd)
if not found:
_handler.redirect(router.to_path(site_index) + "?errors=loggin_error")
else:
token = "%s%s" % (username, AUTH_TOKEN)
_resp.set_cookie('logged_user', str(found.key.id()))
_handler.redirect(router.to_path(site_index))