Esempio n. 1
0
File: web.py Progetto: leeccong/code
    def start_request(self, request):
        SessionPublisher.start_request(self, request)
        os.environ['SQLSTORE_SOURCE'] = request.get_url()

        resp = request.response
        resp.set_content_type('text/html; charset=utf-8')
        resp.set_header('Pragma', 'no-cache')
        resp.set_header('Cache-Control', 'must-revalidate, no-cache, private')
        # FIXME: quixote with origin?
        resp.set_header('Access-Control-Allow-Origin', '*')
        request.enable_ajax = False
        request.browser = request.guess_browser_version()
        request.method = request.get_method()
        request.url = request.get_path()
        request.is_mobile = is_mobile_device(request)
        request.start_time = time.time()
        request.user = None
        check_auth(request)  # OAuth
        if request.user is None:
            request.user = User.get_current_user()

        import_obj_set("request", request)
Esempio n. 2
0
    def start_request(self, request):
        SessionPublisher.start_request(self, request)
        os.environ['SQLSTORE_SOURCE'] = request.get_url()

        resp = request.response
        resp.set_content_type('text/html; charset=utf-8')
        resp.set_header('Pragma', 'no-cache')
        resp.set_header('Cache-Control', 'must-revalidate, no-cache, private')
        # FIXME: quixote with origin?
        resp.set_header('Access-Control-Allow-Origin', '*')
        request.enable_ajax = False
        request.browser = request.guess_browser_version()
        request.method = request.get_method()
        request.url = request.get_path()
        request.is_mobile = is_mobile_device(request)
        request.start_time = time.time()
        request.user = None
        check_auth(request)  # OAuth
        if request.user is None:
            request.user = User.get_current_user()

        import_obj_set("request", request)
Esempio n. 3
0
 def ttest_get_current_user(self):  # noqa
     assert not User.get_current_user()
Esempio n. 4
0
 def test_get_current_user(self):
     assert not User.get_current_user()