2017-07-01 17:48:18 -07:00
|
|
|
# kappa123/server/main/views.py
|
2015-01-21 08:32:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
#################
|
|
|
|
#### imports ####
|
|
|
|
#################
|
|
|
|
|
|
|
|
from flask import render_template, Blueprint
|
2017-07-01 19:21:25 -07:00
|
|
|
#from aaaaaaa import pack_ints, unpack_ints
|
|
|
|
from kappa123.server.runs import inject_run_class, fetch_or_cache_runs
|
|
|
|
def pack_ints(s):
|
|
|
|
return "butts"
|
2015-01-21 08:32:17 -08:00
|
|
|
|
2017-07-01 19:21:25 -07:00
|
|
|
def unpack_ints(s):
|
|
|
|
return set()
|
2015-01-21 08:32:17 -08:00
|
|
|
|
|
|
|
################
|
|
|
|
#### config ####
|
|
|
|
################
|
|
|
|
|
|
|
|
main_blueprint = Blueprint('main', __name__,)
|
|
|
|
|
|
|
|
|
|
|
|
################
|
|
|
|
#### routes ####
|
|
|
|
################
|
|
|
|
|
|
|
|
|
|
|
|
@main_blueprint.route('/')
|
|
|
|
def home():
|
2017-07-01 19:20:21 -07:00
|
|
|
all_runs = fetch_or_cache_runs()
|
|
|
|
return render_template(
|
|
|
|
'main/home.html',
|
|
|
|
runs=all_runs
|
|
|
|
)
|
2015-01-21 08:32:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
@main_blueprint.route("/about/")
|
|
|
|
def about():
|
|
|
|
return render_template("main/about.html")
|
2017-07-01 17:28:56 -07:00
|
|
|
|
|
|
|
@main_blueprint.route("/<preferences>")
|
|
|
|
def returning_user(preferences):
|
|
|
|
unpacked_set = unpack_ints(preferences)
|
2017-07-01 19:20:21 -07:00
|
|
|
all_runs = fetch_or_cache_runs()
|
|
|
|
runs = inject_run_class(all_runs, unpacked_set)
|
|
|
|
return render_template(
|
|
|
|
"main/home.html",
|
|
|
|
runs=runs
|
|
|
|
)
|