当前位置: 首页>>代码示例>>Python>>正文


Python tg.redirect函数代码示例

本文整理汇总了Python中tg.redirect函数的典型用法代码示例。如果您正苦于以下问题:Python redirect函数的具体用法?Python redirect怎么用?Python redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的tg.redirect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。