def application(environ, start_response): """ WSGI application. Handles all requests. :param environ: WSGI enviroment. :param start_response: WSGI start response. :return: Depends on the request. Always a WSGI response where start_response first have to be initialized. """ session = Session(environ) http_helper = HttpHandler(environ, start_response, session, logger) parameters = http_helper.query_dict() test = Test(environ, start_response, session, logger, LOOKUP, config, parameters, CACHE) path = http_helper.path() http_helper.log_request() response = None if http_helper.verify_static(path): return http_helper.handle_static(path) if test.verify(path): return test.handle(path) if response is None: response = http_helper.http404() http_helper.log_response(response) return response
def application(environ, start_response): """ WSGI application. Handles all requests. :param environ: WSGI enviroment. :param start_response: WSGI start response. :return: Depends on the request. Always a WSGI response where start_response first have to be initialized. """ response = None session = Session(environ) http_helper = HttpHandler(environ, start_response, session, logger) parameters = http_helper.query_dict() test = Test(environ, start_response, session, logger, LOOKUP, config, parameters) path = http_helper.path() http_helper.log_request() if http_helper.verify_static(path): return http_helper.handle_static(path) if test.verify(path): return test.handle(path) if response is None: response = http_helper.http404() http_helper.log_response(response) return response
def handle_path(environ, start_response, response_encoder): path = environ.get('PATH_INFO', '').lstrip('/') session = environ['beaker.session'] http_helper = HttpHandler(environ, start_response, session, LOGGER) parameters = http_helper.query_dict() if path == "favicon.ico": return static(environ, start_response, "static/favicon.ico") if path.startswith("static/"): return static(environ, start_response, path) # TODO This is all web frameworks which should be imported via dirg-util if path.startswith("_static/"): return static(environ, start_response, path) if path.startswith("export/"): return static(environ, start_response, path) if path == "": return op_config(environ, start_response, "test_instance_list.mako") if path == "config_page": return op_config(environ, start_response, "op_config.mako") if path == "create_new_config_file": return handle_create_new_config_file(response_encoder, session, parameters) if path == "get_op_config": return handle_get_op_config(session, response_encoder) if path == "does_op_config_exist": return handle_does_op_config_exist(session, response_encoder) if path == "download_config_file": return handle_download_config_file(response_encoder, parameters) if path == "upload_config_file": return handle_upload_config_file(parameters, session, response_encoder) if path == "start_op_tester": return handle_start_test_instance(session, response_encoder, parameters) if path == "get_redirect_url": return handle_get_redirect_url(session, response_encoder, parameters) if path == "request_instance_ids": return handle_request_instance_ids(response_encoder, parameters) if path == "submit_contact_info": return handle_submit_contact_info(response_encoder, parameters) if path == "load_existing_config": return handle_load_existing_config(response_encoder, session, parameters) if path == "load_existing_contact_info": return handle_load_existing_contact_info(response_encoder, parameters) if path == "restart_test_instance": return handle_restart_test_instance(response_encoder, parameters) return http_helper.http404()
def application(environ, start_response): """ WSGI application. Handles all requests. :param environ: WSGI enviroment. :param start_response: WSGI start response. :return: Depends on the request. Always a WSGI response where start_response first have to be initialized. """ global username_password verification = False response = None session = SecureSession(environ, username_password) http_helper = HttpHandler(environ, start_response, session, logger) parameters = http_helper.query_dict() information = Information(environ, start_response, session, logger, parameters, LOOKUP, CACHE, config.AUTHENTICATION_LIST , config.SQLITE_DB, config.EMAIL_CONFIG, sphandler, config.ISSUER, config.IMAGE_FOLDER_PATH) path = http_helper.path() http_helper.log_request() if path=="refresh": username_password = open("auth/user_pass.json").read() username_password = json.loads(username_password) return Response("You have performed a refresh.")(environ, start_response) if http_helper.verify_static(path) or path.startswith(config.IMAGE_FOLDER_PATH): return http_helper.handle_static(path) elif information.verify(path): return information.handle(path) elif sphandler.verify_sp_requests(path): response = sphandler.handle_sp_requests(environ, start_response, path, session, parameters, information) verification = session.is_verification() if response is None: response = http_helper.http404() http_helper.log_response(response) session.verification(verification) return response