コード例 #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
ファイル: circushttpd.py プロジェクト: themgt/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)
コード例 #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)