예제 #1
0
파일: __init__.py 프로젝트: passy/rdreilib
def _redirect_unauthorized(resp):
    if resp.status_code == 401:
        # We need the request for later redirecting.
        req = get_request()
        resp.headers['Location'] = url_for("auth/login", **{REDIRECT_FIELD_NAME:
                                                            req.url})
        resp.status_code = 302
예제 #2
0
    def test_query_tracking(self):
        """Tests query tracking."""

        client = Client(self.app, Response)

        response = client.get('/')
        request = get_request()

        assert len(request.sql_queries) == 2
        assert response.headers['X-SQL-Query-Count'] == '2'
        assert response.headers['X-SQL-Query-Time'] > 0
예제 #3
0
파일: template.py 프로젝트: passy/rdreilib
 def __init__(self):
     self.user = get_request().user
예제 #4
0
파일: gae.py 프로젝트: fugu13/opp-frontpage
def redirect_gae_login_url():
    req = get_request()
    return redirect(users.create_login_url(req.url))