Example #1
0
def redirect_ruri(req, *args):
    item = Redirect()
    item.src = req.uri_rule
    item.get(req, key='src')
    dst = item.dst.format(*args)
    print args
    redirect(req, dst,
             permanent=int(item.code == state.HTTP_MOVED_PERMANENTLY))
Example #2
0
 def test_get_by_src(self, req, redirect):
     item = Redirect(src=redirect.src)
     assert item.get(req, key='src') is not None
     assert item.src == redirect.src
     assert item.dst == redirect.dst
     assert item.code == redirect.code
     assert item.state == redirect.state
Example #3
0
 def test_get(self, req, redirect):
     item = Redirect(redirect.id)
     assert item.get(req) is not None
     assert item.src == redirect.src
     assert item.dst == redirect.dst
     assert item.code == redirect.code
     assert item.state == redirect.state
Example #4
0
def redirect_uri(req, *args):
    item = Redirect()
    item.src = req.uri
    item.get(req, key='src')
    redirect(req, item.dst,
             permanent=int(item.code == state.HTTP_MOVED_PERMANENTLY))