def philo_dispatcher(environ, start_response): """Dispatcher function.""" loop = get_event_loop() clean_task = loop.create_task(clean_up()) config = WebConfig(path) request = WSGIHandler(environ, config) response = "" if request.content_type == "application/json" or request.format == "json": try: path_components = [c for c in environ["PATH_INFO"].split("/") if c] except: path_components = [] if path_components: if path_components[-1] == "table-of-contents": response = "".join([ i for i in reports.table_of_contents(environ, start_response) ]) else: response = "".join( [i for i in reports.navigation(environ, start_response)]) else: report = getattr(reports, FieldStorage().getvalue("report")) response = "".join([i for i in report(environ, start_response)]) else: response = angular(environ, start_response) yield response.encode("utf8") loop.run_until_complete(clean_task)
def philo_dispatcher(environ, start_response): """Dispatcher function.""" config = WebConfig(os.path.abspath(os.path.dirname(__file__))) request = WSGIHandler(environ, config) if request.content_type == "application/json": try: path_components = [c for c in environ["PATH_INFO"].split("/") if c] except: path_components = [] if path_components: if path_components[-1] == "table-of-contents": yield ''.join([i for i in reports.table_of_contents(environ, start_response)]) else: yield ''.join([i for i in getattr(reports, "navigation")(environ, start_response)]) else: report = FieldStorage().getvalue('report') yield ''.join([i for i in getattr(reports, report or "concordance")(environ, start_response)]) else: yield angular(environ, start_response)
def philo_dispatcher(environ, start_response): """Dispatcher function.""" clean_up() config = WebConfig(path) request = WSGIHandler(environ, config) if request.content_type == "application/json" or request.format == "json": try: path_components = [c for c in environ["PATH_INFO"].split("/") if c] except: path_components = [] if path_components: if path_components[-1] == "table-of-contents": yield ''.join([i for i in reports.table_of_contents(environ, start_response)]) else: yield ''.join([i for i in reports.navigation(environ, start_response)]) else: report = getattr(reports, FieldStorage().getvalue('report')) yield ''.join([i for i in report(environ, start_response)]) else: yield angular(environ, start_response)
def philo_dispatcher(environ, start_response): """Dispatcher function.""" clean_up() config = WebConfig(path) request = WSGIHandler(environ, config) if request.content_type == "application/json" or request.format == "json": try: path_components = [c for c in environ["PATH_INFO"].split("/") if c] except: path_components = [] if path_components: if path_components[-1] == "table-of-contents": yield ''.join([ i for i in reports.table_of_contents(environ, start_response) ]) else: yield ''.join( [i for i in reports.navigation(environ, start_response)]) else: report = getattr(reports, FieldStorage().getvalue('report')) yield ''.join([i for i in report(environ, start_response)]) else: yield angular(environ, start_response)
def philo_dispatcher(environ, start_response): report = FieldStorage().getvalue('report') config = f.WebConfig() db = DB(config.db_path + '/data/') request = WSGIHandler(db, environ) if request.content_type == "application/json": try: path_components = [c for c in environ["PATH_INFO"].split("/") if c] except: path_components = [] if path_components: if path_components[-1] == "table-of-contents": yield ''.join([i for i in reports.table_of_contents( environ, start_response)]) else: yield ''.join([i for i in getattr(reports, "navigation")( environ, start_response)]) yield ''.join([i for i in getattr(reports, report or "navigation")( environ, start_response)]) else: yield ''.join([i for i in getattr( reports, report or "concordance")(environ, start_response)]) else: yield f.webApp.angular(environ, start_response)