Ejemplo n.º 1
0
 def default(self, sendby=None):
     if sendby == 'forward':
         forward('AppLevelView')
         assert False
     if sendby == 'redirect':
         redirect('/applevelview/foo')
         assert False
     if sendby == 'rdp':
         redirect('/applevelview/foo', permanent=True)
     if sendby == '303':
         redirect('/applevelview/foo', code=303)
     return 'news index'
Ejemplo n.º 2
0
def send_to_index(sender, endpoint, urlargs):
    """
    simulating hijacking the request and forcing it to go to another view.
    This minicks what you would want to do if a user need to change a password,
    was locked out, or any number of things that might cause you to want to
    send them to a different location than the one they are requesting.
    """
    if 'request-hijack/forward' in rg.request.url:
        # we have to have a flag that says we have already forwarded, otherwise
        # we will get a forward loop since the request isn't modified
        # when we forward
        if getattr(rg, 'newlayout_events_send_to_index', None):
            return
        rg.newlayout_events_send_to_index = True
        forward('Index', tname='index')
    elif 'request-hijack/redirect' in rg.request.url:
        redirect('/index/index')
Ejemplo n.º 3
0
def send_to_index(sender, endpoint, urlargs):
    """
    simulating hijacking the request and forcing it to go to another view.
    This minicks what you would want to do if a user need to change a password,
    was locked out, or any number of things that might cause you to want to
    send them to a different location than the one they are requesting.
    """
    if 'request-hijack/forward' in rg.request.url:
        # we have to have a flag that says we have already forwarded, otherwise
        # we will get a forward loop since the request isn't modified
        # when we forward
        if getattr(rg, 'newlayout_events_send_to_index', None):
            return
        rg.newlayout_events_send_to_index = True
        forward('Index', tname='index')
    elif 'request-hijack/redirect' in rg.request.url:
        redirect('index/index')
Ejemplo n.º 4
0
 def default(self):
     forward('tests:ForwardTo')
Ejemplo n.º 5
0
 def default(self):
     forward('tests:ForwardLoop')
Ejemplo n.º 6
0
def check_reset_required(sender, endpoint, urlargs):
    skip_endpoints = ['auth:ChangePassword', 'auth:Logout']
    if user.is_authenticated and user.reset_required and endpoint not in skip_endpoints:
        forward('auth:ChangePassword')
Ejemplo n.º 7
0
def page1():
    forward('page2')
    return 'hello nosession!'
Ejemplo n.º 8
0
 def default(self, sendby=None):
     forward('AppLevelView', v1='a', v2='b')
Ejemplo n.º 9
0
 def default(self):
     forward('tests:ForwardTo')
Ejemplo n.º 10
0
 def default(self):
     forward('tests:ForwardLoop')