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


Python tipfy.url_for函数代码示例

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


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

示例1: post

    def post(self, **kwargs):
        redirect_url = self.redirect_path()

        if self.auth_current_user:
            # User is already registered, so don't display the signup form.
            return redirect(redirect_url)

        if self.form.validate():
            username = self.form.username.data
            password = self.form.password.data
            remember = self.form.remember.data

            user = self.auth_get_user_entity(username=username)
            if user is not None and user.disabled is not None and user.disabled is True:
               self.set_message('error', 'Your account has been disabled.  You can request a new account if you like. ', life=None) 
            else :
                res = self.auth_login_with_form(username, password, remember)
                if self.auth_current_user and self.auth_current_user.assigned_to is not None:
                    logging.log(logging.INFO, "assigned to client " + self.auth_current_user.assigned_to)
                    self.session['client'] = self.auth_current_user.assigned_to
                    redirect_url = url_for("clients-pretty") 
                if self.auth_current_user and self.auth_current_user.is_admin: 
                    redirect_url = url_for("admin-dashboard")                 
                if res:
                    return redirect(redirect_url)
                self.set_message('error', 'Authentication failed. Please try again.', life=None)
                
        return self.get(**kwargs)
开发者ID:nebulae,项目名称:vbitools,代码行数:28,代码来源:handlers.py

示例2: test_url_for_with_anchor

    def test_url_for_with_anchor(self):
        app = get_app()
        request = get_request(app, base_url='http://foo.com')
        app.match_url(request)

        assert url_for('home', _anchor='my-little-anchor') == '/#my-little-anchor'
        assert url_for('home', _full=True, _anchor='my-little-anchor') == 'http://foo.com/#my-little-anchor'
开发者ID:strogo,项目名称:tipfy,代码行数:7,代码来源:test_routing.py

示例3: test_url_for2

    def test_url_for2(self):
        app = get_app()
        request = get_request(app, base_url='http://foo.com')
        app.match_url(request)

        assert url_for('profile', username='calvin') == '/people/calvin'
        assert url_for('profile', username='hobbes') == '/people/hobbes'
        assert url_for('profile', username='moe') == '/people/moe'
开发者ID:strogo,项目名称:tipfy,代码行数:8,代码来源:test_routing.py

示例4: get

 def get(self, **kwargs):
     if self.auth_current_user:
         if self.auth_current_user.is_admin or self.auth_current_user.is_staff:
              return self.redirect(url_for('admin-dashboard'))
         else: 
             return self.redirect(url_for('clients-pretty'))
     else: 
        return self.redirect(url_for('auth/login')) 
开发者ID:nebulae,项目名称:vbitools,代码行数:8,代码来源:handlers.py

示例5: get

    def get(self, **kwargs):
        redirect_url = self.redirect_path()

        if self.auth_current_user:
            # User is already registered, so don't display the signup form.
            return redirect(redirect_url)

        opts = {'continue': self.redirect_path()}
        context = {
            'form':                 self.form,
            'facebook_login_url':   url_for('auth/facebook', **opts),
            'google_login_url':     url_for('auth/google', **opts),
            'twitter_login_url':    url_for('auth/twitter', **opts),
        }
        return self.render_response('users/login.html', **context)
开发者ID:macat,项目名称:Piratetitler,代码行数:15,代码来源:handlers.py

示例6: get

    def get(self, exception=None, handler=None):
        logging.exception(exception)
        # Initial breadcrumbs for this app.
        self.request.context['breadcrumbs'] = [
            (url_for('home/index', area_name=self.area.name),
                i18n._('Home'))
        ]
        kwargs = {}
        code = 500
        template = 'base/error_500.html'

        if isinstance(exception, HTTPException):
            kwargs = {}
            code = exception.code
            if code in (404, 500):
                if exception.description != exception.__class__.description:
                    kwargs['message'] = exception.description

                template = 'base/error_%d.html' % code
            else:
                kwargs['message'] = exception.description

        response = self.render_response(template, **kwargs)
        response.status_code = code
        return response
开发者ID:ac001,项目名称:moe,代码行数:25,代码来源:handlers.py

示例7: get

 def get(self, **kwargs):
   race = db.get(kwargs['id'])
   templateValues = {'title'        : 'Update Race',
                     'submit_url'   : url_for('race/update', id=kwargs['id']),
                     'existingRace' : get_property_dict(race)}
   templateValues['existingRace']['imageUrl'] = race.imageUrl
   return self.render_page('race-form.html', **templateValues)
开发者ID:cconger,项目名称:BuildCraft,代码行数:7,代码来源:race.py

示例8: get

    def get(self, exception=None, handler=None):
        # Always log exceptions.
        logging.exception(exception)

        # Get the exception code and description, if it is an HTTPException,
        # or assume 500.
        code = getattr(exception, "code", 500)
        message = getattr(exception, "description", None)

        if self.app.dev and code not in (404,):
            # Raise the exception in dev except for NotFound.
            raise

        if code in (403, 404):
            # Render a special template for these codes.
            template = "base/error_%d.html" % code
        else:
            # Render a generic 500 template.
            template = "base/error_500.html"

        # Set breadcrumbs to follow rest of the site.
        self.request.context["breadcrumbs"] = [(url_for("home/index", area_name=self.area.name), i18n._("Home"))]

        # Render the template using the exception message, if any, and set
        # the status code.
        response = self.render_response(template, message=message)
        response.status_code = code
        return response
开发者ID:wvega,项目名称:sp-unal,代码行数:28,代码来源:handlers.py

示例9: post

	def post(self):
		entity=db.get(db.Key(self.request.form.get('entity_key')))
		entity.status=self.request.form.get('new_status')
		entity.put()
		return redirect(url_for('links/review'))
		
		
开发者ID:Hubble1,项目名称:eventgrinder,代码行数:5,代码来源:handlers.py

示例10: get

  def get(self, **kwargs):
    results = GameVersion.all().fetch(10)

    templateValues = {'gameVersions'  : results,
                      'create_url'    : url_for('version/create')}

    return self.render_page('game-versions.html', **templateValues)
开发者ID:cconger,项目名称:BuildCraft,代码行数:7,代码来源:gameversion.py

示例11: get

 def get(self, file_key=None, **kwargs):
     template = 'admin/files/new.html'
     context = {
         'form': self.form,
         'upload_url': blobstore.create_upload_url(url_for('blobstore/upload'))
     }
     return self.render_response(template, **context)
开发者ID:tresacton,项目名称:gae-shop,代码行数:7,代码来源:handlers.py

示例12: get

  def get(self, **kwargs):
    templateValues = {'title'           : 'Create Buildable',
                      'submit_url'      : url_for('buildable/create'),
                      'races'           : Race.all().fetch(10),
                      'gameVersions'    : GameVersion.all().fetch(10)}

    return self.render_page('buildable-form.html', **templateValues)
开发者ID:cconger,项目名称:BuildCraft,代码行数:7,代码来源:buildable.py

示例13: get

    def get(self, **kwargs):
        tasks = self._getTasks()

        context = {
            'tasks':                tasks,
            'add_task_url':         url_for('tasks-new'),
        }
        return self.render_response('tasks/index.html', **context)
开发者ID:nulltoken,项目名称:Theoleyre,代码行数:8,代码来源:handlers.py

示例14: get

    def get(self):
    	download_url = url_for('cashblob/download')
        html = ''
        html += '<html><body>'
        html += '<form action="%s" method="POST">' % download_url
        html += """Account: <input type="text" name="account"><br> <input type="submit"
            name="submit" value="Submit"> </form></body></html>"""

        return Response(html, mimetype='text/html')
开发者ID:brunsky,项目名称:CashBlob,代码行数:9,代码来源:handlers.py

示例15: getPages

 def getPages(self):
     pages = Page.gql('ORDER BY sequenceNumber')
     processedPages=[]
     for page in pages:
         p={
            'url': url_for('page_def', number=page.pageLabel),
            'name': 'Page %s' % (page.pageLabel),
            }
         processedPages.append(p)
     return processedPages
开发者ID:hamish,项目名称:HotCurrie,代码行数:10,代码来源:handlers.py


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