#!/usr/bin/env python3 import sys sys.path.append("../") from jinja2 import Environment, select_autoescape, FileSystemLoader from os import environ from settings.settings import settings from modules.HttpServer import HttpServer from modules.WebManager import WebManager http_server = HttpServer(environ, sys.stdin) web_manager = WebManager(http_server, None) template_folder = 'templates' def fetch_template(template_file): template_loader = FileSystemLoader(template_folder) env = Environment(loader=template_loader, autoescape=select_autoescape(['html', 'xml'])) template = env.get_template(template_file) return template def handle_get(http_server, database_manager, session, account): template = fetch_template("pricing.jinja.htm") keys = {} output = template.render(keys) http_server.print_headers() print(output)
autoescape=select_autoescape(['html', 'xml'])) template = env.get_template(template_file) return template def get_ordinality(number): ordinalities = ["th", "st", "nd", "rd"] if number % 10 in [1, 2, 3] and number not in [11, 12, 13]: return ordinalities[number % 10] else: return ordinalities[0] http_server = HttpServer(environ, sys.stdin) database_manager = get_database_connection(settings["mysql"]) web_manager = WebManager(http_server, database_manager) def handle_get(http_server, database_manager, session, account): if account.is_phone_verified != 1: redirect_to_phone_confirmation(http_server, database_manager, session, account) else: keys = {'current_page': "billing"} template = fetch_template("account/billing.jinja.htm") # http_server.print_headers() # print(dict(account)) subscription_plan_template = SubscriptionPlan(database_manager) subscription_conditions = [{ "column": "is_active",