Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(14)  |  Call(9)  |  Derive(0)  |  Import(5)
A redirect shortcut class for redirection responses
This class can make two types of redirects:
 1. Absolute path redirects: When you want do redirect to outside your
    application.
 2. Root App relative redirect: If you want your redirection relative to
    the root application path

 e.g If Your application is deployed on http://server/apps/myapp, a
 Redirect("/some/path") actually will generate a redirect to
 "/apps/myapp/some/path" and a Redirect("/some/path", absolute_path=True)(more...)

src/p/y/pyroutes-HEAD/examples/wiki.py   pyroutes(Download)
 
from pyroutes import route, application, utils
from pyroutes.http.response import Response, Redirect
from pyroutes.template import TemplateRenderer
 
def main(request, page='index'):
    return Redirect('/show/%s' % page)
 
@route('/edit')
def edit(request, node='index'):
    if 'new_node_data' in request.POST:
        nodes[node] = request.POST['new_node_data']
        return Redirect('/show/%s' % node)
def show(request, node='index'):
    node_contents = nodes.get(node)
 
    if node_contents is None:
        return Redirect("/edit/%s" % node)

src/p/y/pyroutes-HEAD/pyroutes/utils.py   pyroutes(Download)
from pyroutes import settings
from pyroutes.template import TemplateRenderer
from pyroutes.http.response import Response, Redirect, Http403, Http404
from pyroutes.contrib import autoreload
 
    if os.path.isdir(path):
        if not request.ENV['PATH_INFO'].endswith('/'):
            return Redirect(path.lstrip('.') + '/')
 
        listing = []

src/p/y/pyroutes-0.5.0/pyroutes/utils.py   pyroutes(Download)
from pyroutes import settings
from pyroutes.template import TemplateRenderer
from pyroutes.http.response import Response, Redirect, Http403, Http404
from pyroutes.contrib import autoreload
 
    if os.path.isdir(path):
        if not request.ENV['PATH_INFO'].endswith('/'):
            return Redirect(path.lstrip('.') + '/')
 
        listing = []

src/p/y/pyroutes-HEAD/pyroutes/middleware/appendslash.py   pyroutes(Download)
"""
Contains the AppendSlashes middleware.
"""
 
from pyroutes.http.response import Redirect
            if request.POST:
                return self.passthrough(request)
            return Redirect(request.ENV['PATH_INFO'] + '/?' +
                    request.ENV['QUERY_STRING'])
        if request.ENV['PATH_INFO'].endswith('/'):
            return self.passthrough(request)
        return Redirect(request.ENV['PATH_INFO'] + '/')

src/p/y/pyroutes-0.5.0/pyroutes/middleware/appendslash.py   pyroutes(Download)
"""
Contains the AppendSlashes middleware.
"""
 
from pyroutes.http.response import Redirect
            if request.POST:
                return self.passthrough(request)
            return Redirect(request.ENV['PATH_INFO'] + '/?' +
                    request.ENV['QUERY_STRING'])
        if request.ENV['PATH_INFO'].endswith('/'):
            return self.passthrough(request)
        return Redirect(request.ENV['PATH_INFO'] + '/')