Exemplo n.º 1
0
 def wrapper(func):
     def client_or_redirect(*fargs, **fkwargs):
         if ensure_client:
             global client
             if client is None:
                 session = get_session()
                 if 'endpoint' in session:
                     client = connect_to_endpoint(session['endpoint'])
                 else:
                     return redirect('/connect')
         return func(*fargs, **fkwargs)
     return route_(*args, **kwargs)(client_or_redirect)
Exemplo n.º 2
0
    def wrapper(func):
        def client_or_redirect(*fargs, **fkwargs):
            if ensure_client:
                global client
                if client is None:
                    session = get_session()
                    if 'endpoint' in session:
                        client = connect_to_endpoint(session['endpoint'])
                    else:
                        return redirect('/connect')
            return func(*fargs, **fkwargs)

        return route_(*args, **kwargs)(client_or_redirect)
Exemplo n.º 3
0
Arquivo: util.py Projeto: Natim/circus
    def wrapper(func):
        def client_or_redirect(*fargs, **fkwargs):
            if ensure_client:
                client = get_client()
                session = get_session()

                if client is None:
                    session = get_session()
                    if session.get('endpoint', None) is not None:
                        # XXX we need to pass SSH too here
                        connect_to_circus(session['endpoint'])
                    else:
                        return redirect('/connect')

            return func(*fargs, **fkwargs)
        return route_(*args, **kwargs)(client_or_redirect)
Exemplo n.º 4
0
    def wrapper(func):
        def client_or_redirect(*fargs, **fkwargs):
            if ensure_client:
                client = get_client()
                session = get_session()

                if client is None:
                    session = get_session()
                    if session.get('endpoint', None) is not None:
                        # XXX we need to pass SSH too here
                        connect_to_circus(session['endpoint'])
                    else:
                        return redirect('/connect')

            return func(*fargs, **fkwargs)

        return route_(*args, **kwargs)(client_or_redirect)