예제 #1
0
파일: circushttpd.py 프로젝트: mineo/circus
 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)
예제 #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)
예제 #3
0
파일: util.py 프로젝트: 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)
예제 #4
0
파일: util.py 프로젝트: santagada/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)