本文整理汇总了Python中tg.redirect函数的典型用法代码示例。如果您正苦于以下问题:Python redirect函数的具体用法?Python redirect怎么用?Python redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: listadoItemsParaAsignaraLineaBase
def listadoItemsParaAsignaraLineaBase(self, id_proyecto, id_fase, id_linea_base, page=1):
"""Metodo para listar todos los items a asignar a la linea base"""
lineabase=DBSession.query(LineaBase).get(id_linea_base)
if lineabase.estado=='Aprobado':
flash(_("La Linea Base ya se encuentra aprobada"), 'warning')
redirect("/admin/linea_base/listado_linea_bases",id_proyecto=id_proyecto, id_fase=id_fase)
linea_bases=DBSession.query(LineaBase).filter_by(id_fase=id_fase)
itemsenLineaBase = []
for linea_base in linea_bases:
itemsLineaBase = linea_base.items
for itemLineaBase in itemsLineaBase:
itemsenLineaBase.append(itemLineaBase)
#items Contiene todos los items que se encuentran en la fase actual
tipo_items=DBSession.query(TipoItem).filter_by(id_fase=id_fase)
itemsDeFaseActual = []
for tipo_item in tipo_items:
itemsTipoItem = DBSession.query(Item).filter_by(id_tipo_item=tipo_item.id_tipo_item).filter_by(vivo=True).filter_by(estado='Aprobado').order_by(Item.id_item)
for itemTipoItem in itemsTipoItem:
itemsDeFaseActual.append(itemTipoItem)
items=itemsDeFaseActual
if itemsenLineaBase != None:
for item in itemsenLineaBase:
if items.count(item) >= 1:
items.remove(item)
currentPage = paginate.Page(items, page)
return dict(items=currentPage.items, page='listadoItemsParaAsignaraLineaBase', id_proyecto=id_proyecto,
id_fase=id_fase, id_linea_base=id_linea_base, currentPage=currentPage)
开发者ID:albertgarcpy,项目名称:IS2SAP,代码行数:27,代码来源:linea_base_controlador.py
示例2: assign_license
def assign_license(self, **kwargs):
user_name = request.identity['repoze.who.userid']
user_id = DBSession.query(model.User.user_id).filter(model.User.user_name==user_name).first().user_id
#Report if computer or license don't belong to user who is logged in and available > 0
if DBSession.query(model.Computer).filter(model.Computer.id==kwargs['computer'], model.Computer.user_id==user_id).count() < 1 or DBSession.query(model.License).filter(model.License.id==kwargs['license'], model.License.user_id==user_id).count() < 1 or DBSession.query(model.License.available).filter(model.License.id==kwargs['license'], model.License.user_id==user_id).first().available < 1:
flash(('This incident has been reported'), 'error')
redirect('/manage')
a = model.Assignment()
a.user_id = user_id
a.license_id = kwargs['license']
a.computer_id = kwargs['computer']
a.count = 1
a.locked = False
model.DBSession.add(a)
license = DBSession.query(model.License).filter(model.License.id==a.license_id).first()
license.available = license.available - a.count
model.DBSession.flush()
flash("Assignment added.")
redirect('/manage')
开发者ID:AuthorityFX,项目名称:licensing-portal,代码行数:27,代码来源:root.py
示例3: delete
def delete(self, id, **kw):
''' Delete department from DB
'''
log.info('delete ' + kw['_id'])
DBSession.delete(DBSession.query(Department).get(kw['_id']))
flash(u'Service supprimé', 'notice')
redirect('/departments/')
开发者ID:sysnux,项目名称:astportal,代码行数:7,代码来源:department.py
示例4: post
def post(self, id, args={}, **kw):
"""
Evento invocado luego de un evento post en el form de editar
ecargado de asociar a los usuarios con las fases y sus permisos.
@type id : Integer
@param id : Identificador de la fase.
@type args : Hash
@param args : Argumentos de template
@type kw : Hash
@param kw : Keywords
"""
fase = fase_util.get_current()
_usuarios = usuario_util.get_usuarios_by_fase(fase.id_fase)
for usuario in _usuarios:
self.delete(fase.id_fase ,usuario.usuario_id, False)
usuarios = []
for key in kw:
usuarios.append(key)
list = DBSession.query(Usuario).\
filter(Usuario.user_name.in_(usuarios)).all()
for usuario in list:
usuario_util.asociar_usuario_fase(usuario.usuario_id, fase.id_fase)
redirect("/miproyecto/fase/get_all/" + str(fase.id_fase) )
开发者ID:mbaez,项目名称:SAP,代码行数:30,代码来源:participante.py
示例5: delete
def delete(self, proyecto_id ,id, **kw):
"""
@type proyecto_id : Integer
@param proyecto_id : Identificador del proyecto
@type id : Integer
@param id : Identificador del usuario a desvincular.
@type kw : Hash
@param kw : Keywords
"""
#se obtienen las relaciones del usuario sobre las fases del proyecto
list = DBSession.query(UsuarioPermisoFase).\
filter(UsuarioPermisoFase.usuario_id == id).\
filter(Fase.proyecto == proyecto_id).\
filter(UsuarioPermisoFase.fase_id == Fase.id_fase)
#Se eliminan las relaciones del usuario con las fases
for element in list :
DBSession.delete(element)
#Se obtienen los roles del usuario en el proyecto
list = DBSession.query(RolUsuario).\
filter(RolUsuario.usuario_id == id).\
filter(RolUsuario.rol_id == RolPermisoProyecto.rol_id).\
filter(RolPermisoProyecto.proyecto_id == proyecto_id)
#Se eliminan los roles del usuario sobre el proyecto
for element in list :
DBSession.delete(element)
flash("El usuario '"+ str(id) +"' ha sido desvinculado del proyecto.")
redirect("/miproyecto/ver/"+str(proyecto_id))
开发者ID:mbaez,项目名称:SAP,代码行数:30,代码来源:participante.py
示例6: save
def save(self, **kw):
require_access(c.app, 'write')
rate_limit()
post = BM.BlogPost.new(**kw)
g.spam_checker.check(kw['title'] + u'\n' + kw['text'], artifact=post,
user=c.user, content_type='blog-post')
redirect(h.really_unicode(post.url()).encode('utf-8'))
开发者ID:abhinavthomas,项目名称:allura,代码行数:7,代码来源:main.py
示例7: set_options
def set_options(self, show_discussion=False, allow_email_posting=False):
self.app.config.options[
'show_discussion'] = show_discussion and True or False
self.app.config.options[
'AllowEmailPosting'] = allow_email_posting and True or False
flash('Blog options updated')
redirect(request.referer)
开发者ID:abhinavthomas,项目名称:allura,代码行数:7,代码来源:main.py
示例8: clone
def clone(self,
repo_type=None, source_url=None,
mount_point=None, mount_label=None,
**kw):
require_access(c.project, 'admin')
if repo_type is None:
return (
'<form method="get">'
'<input name="repo_type" value="Git">'
'<input name="source_url">'
'<input type="submit">'
'</form>')
for ep in pkg_resources.iter_entry_points('allura', repo_type):
break
if ep is None or source_url is None:
raise exc.HTTPNotFound
h.log_action(log, 'install tool').info(
'clone repo from %s', source_url,
meta=dict(tool_type=repo_type, mount_point=mount_point, mount_label=mount_label))
c.project.install_app(
repo_type,
mount_point=mount_point,
mount_label=mount_label,
init_from_url=source_url)
M.AuditLog.log('Create repo as clone')
redirect('tools')
开发者ID:johnsca,项目名称:incubator-allura,代码行数:26,代码来源:admin_main.py
示例9: delete_screenshot
def delete_screenshot(self, id=None, **kw):
require_access(c.project, 'update')
if id is not None and id != '':
M.AuditLog.log('remove screenshot')
M.ProjectFile.query.remove(dict(project_id=c.project._id, _id=ObjectId(id)))
g.post_event('project_updated')
redirect('screenshots')
开发者ID:johnsca,项目名称:incubator-allura,代码行数:7,代码来源:admin_main.py
示例10: check_access
def check_access():
'''Check access rights / group: admin=full access, boss=users from same department, user.
Returns SA Query object for selected CDRs
'''
if in_any_group('admin', 'APPELS'):
cdrs = DBSession.query(CDR)
elif in_group('CDS'):
# Find list of phones from the user's list of phones
# user_phones -> departments -> phones
phones = []
for p in request.identity['user'].phone:
log.info('CDS phone %s -> department %s' % (p, p.department))
for d in [d.department for d in request.identity['user'].phone]:
log.info('CDS department <%s>' % (d))
for p in d.phones:
phones.append(p)
src = [prefix_src + p.exten for p in phones]
dst = [p.exten for p in phones]
cdrs = DBSession.query(CDR).filter( (CDR.src.in_(src)) | (CDR.dst.in_(dst)) )
log.info('CDS phone <%s> -> source <%s>, destination <%s>' % (
request.identity['user'].phone, src, dst))
elif in_group('utilisateurs'):
src = [prefix_src + p.exten for p in request.identity['user'].phone]
dst = [p.exten for p in request.identity['user'].phone]
cdrs = DBSession.query(CDR).filter( (CDR.src.in_(src)) | (CDR.dst.in_(dst)) )
else:
flash(u'Accès interdit')
redirect('/')
return cdrs
开发者ID:sysnux,项目名称:astportal,代码行数:35,代码来源:cdr.py
示例11: delete
def delete(self, fileid):
try:
userfile = DBSession.query(UserFile).filter_by(id=fileid).one()
except:
return redirect("/")
DBSession.delete(userfile)
return redirect("/")
开发者ID:gbanegas,项目名称:HappyClient,代码行数:7,代码来源:filecontroller.py
示例12: set_home
def set_home(self, new_home):
self.app.root_page_name = new_home
self.app.upsert_root(new_home)
flash('Home updated')
mount_base = c.project.url()+self.app.config.options.mount_point+'/'
url = h.really_unicode(mount_base).encode('utf-8') + h.really_unicode(new_home).encode('utf-8')+'/'
redirect(url)
开发者ID:Bitergia,项目名称:allura,代码行数:7,代码来源:wiki_main.py
示例13: attach
def attach(self, file_info=None):
if not self.page:
raise exc.HTTPNotFound
require_access(self.page, 'edit')
if hasattr(file_info, 'file'):
self.page.attach(file_info.filename, file_info.file, content_type=file_info.type)
redirect(request.referer)
开发者ID:Bitergia,项目名称:allura,代码行数:7,代码来源:wiki_main.py
示例14: _lookup
def _lookup(self, pname, *remainder):
page = WM.Page.query.get(
app_config_id=c.app.config._id, title=pname)
if page:
redirect(page.url())
else:
raise exc.HTTPNotFound
开发者ID:Bitergia,项目名称:allura,代码行数:7,代码来源:wiki_main.py
示例15: save
def save(self, email_address, display_name, club,
tracking_delay=0, unit_preset=1,
distance_unit=1, speed_unit=1,
lift_unit=0, altitude_unit=0,
eye_candy=False, **kwargs):
if not self.user.is_writable(request.identity):
raise HTTPForbidden
self.user.email_address = email_address
self.user.display_name = display_name
if not club:
club = None
self.user.club_id = club
self.user.tracking_delay = tracking_delay
unit_preset = int(unit_preset)
if unit_preset == 0:
self.user.distance_unit = distance_unit
self.user.speed_unit = speed_unit
self.user.lift_unit = lift_unit
self.user.altitude_unit = altitude_unit
else:
self.user.unit_preset = unit_preset
self.user.eye_candy = eye_candy
DBSession.flush()
redirect('.')
开发者ID:gabor-konrad,项目名称:Skylines,代码行数:28,代码来源:users.py
示例16: update
def update(self, card=None, **kw):
permissions = self._index_permissions()
old_permissions = dict(permissions)
for args in card:
perm = args['id']
new_group_ids = args.get('new', [])
group_ids = args.get('value', [])
if isinstance(new_group_ids, basestring):
new_group_ids = [ new_group_ids ]
if isinstance(group_ids, basestring):
group_ids = [ group_ids ]
# make sure the admin group has the admin permission
if perm == 'admin':
if c.project.is_root:
pid = c.project._id
else:
pid = c.project.parent_id
admin_group_id = str(M.ProjectRole.query.get(project_id=pid, name='Admin')._id)
if admin_group_id not in group_ids + new_group_ids:
flash('You cannot remove the admin group from the admin permission.','warning')
group_ids.append(admin_group_id)
permissions[perm] = []
role_ids = map(ObjectId, group_ids + new_group_ids)
permissions[perm] = role_ids
c.project.acl = []
for perm, role_ids in permissions.iteritems():
role_names = lambda ids: ','.join(sorted(
pr.name for pr in M.ProjectRole.query.find(dict(_id={'$in':ids}))))
old_role_ids = old_permissions.get(perm, [])
if old_role_ids != role_ids:
M.AuditLog.log('updated "%s" permissions: "%s" => "%s"',
perm,role_names(old_role_ids), role_names(role_ids))
c.project.acl += [M.ACE.allow(rid, perm) for rid in role_ids]
g.post_event('project_updated')
redirect('.')
开发者ID:johnsca,项目名称:incubator-allura,代码行数:35,代码来源:admin_main.py
示例17: tracking_register
def tracking_register(self, came_from='/tracking/info'):
if not self.user.is_writable(request.identity):
raise HTTPForbidden
self.user.generate_tracking_key()
redirect(came_from)
开发者ID:gabor-konrad,项目名称:Skylines,代码行数:7,代码来源:users.py
示例18: put
def put(self, args={}, **kw):
"""
Evento invocado luego de un evento post en el form de editar
ecargado de persistir las modificaciones de las instancias.
@type args : Hash
@param args : Argumentos de template
@type kw : Hash
@param kw : Keywords
"""
del kw['sprox_id']
rol = DBSession.query(Rol).get(int(kw['rol_id']))
rol.nombre = kw['nombre']
rol.codigo = kw['codigo']
rol.descripcion = kw['descripcion']
rol.is_template = kw['is_template']
rol.permisos = []
for permiso_id in kw['permisos'] :
rol.permisos.append(DBSession.query(Permiso).get(permiso_id))
DBSession.merge(rol)
flash("El rol '"+rol.nombre+"' ha sido modificado correctamente.")
redirect("/administracion/rol/get_all")
开发者ID:mbaez,项目名称:SAP,代码行数:26,代码来源:rol.py
示例19: revert
def revert(self, version, **kw):
require_access(self.post, 'write')
orig = self._get_version(version)
if orig:
self.post.text = orig.text
self.post.commit()
redirect('.')
开发者ID:abhinavthomas,项目名称:allura,代码行数:7,代码来源:main.py
示例20: post
def post(self, args={}, **kw):
"""
Evento invocado luego de un evento post en el form de crear
ecargado de persistir las nuevas instancias.
@type args : Hash
@param args : Argumentos de template
@type kw : Hash
@param kw : Keywords
"""
del kw['sprox_id']
rol = Rol()
rol.codigo = kw['codigo']
rol.nombre = kw['nombre']
rol.descripcion = kw['descripcion']
for permiso in kw['permisos'] :
rol.permisos.append(DBSession.query(Permiso).get(permiso))
DBSession.add(rol)
flash("El rol ha sido creado correctamente.")
redirect("/administracion/rol/get_all")
开发者ID:mbaez,项目名称:SAP,代码行数:25,代码来源:rol.py
注:本文中的tg.redirect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论