#gamePage.py #generation of static game content from mako_defs import gp_template import databeast import os root = '/var/www/Project-EFH/' beast = databeast.dataBeast("funkyTrain", "games") scripts = ['jquery', 'gamequery', '../js/Subject.js', '../js/shuffler.js', '../js/gameFuncs.js', '../js/common.js', '../js/sprintf.js', '../js/makeCueList.js', '../css/common.css', '../css/gamePage.css'] for gid in beast.distinct('gid'): #get some game info filename = beast.select("filename", {'gid':gid}) game = beast.select("name", {'gid':gid}) instructions = beast.select("notes", {'gid':gid}) #build the header extrascripts = ['%s.css' % filename, '%s_constants.js' % filename, '%s.js' % filename] arg = scripts + extrascripts output = gp_template.get_def("head").render(title=game, scripts=arg) info_content = [] header = gp_template.get_def("header").render(user="") #game info div controls = beast.select("controls", {'gid':gid}) info_content.append(['Controls', controls])
# gamePage.py # generation of static game content from mako_defs import gp_template import databeast import os root = "/var/www/Project-EFH/" beast = databeast.dataBeast("funkyTrain", "training") # build the <head> scripts = ["jquery", "css/common.css", "js/common.js", "js/main.js"] output = gp_template.get_def("head").render(title="all aboard the funkyTrain", scripts=scripts) # header div header = gp_template.get_def("header").render(user="") # some content messages = gp_template.get_def("title_div").render(ID="messages", title="Messages", data="No messages.", title_lvl=3) scores = gp_template.get_def("title_div").render(ID="scores", title="High Scores", data=":)", title_lvl=3) # schedule = gp_template.get_def("title_div").render(ID="schedule", title="Your training schedule", data="", title_lvl=3) # footer div footer = gp_template.get_def("footer").render() # add it to the <body> output += gp_template.get_def("body").render(data=header + messages + scores + footer)
def index(self): self.beast = databeast.dataBeast("funkyTrain", "users") create = gp_template.get_def("account_create").render() reset = gp_template.get_def("account_reset").render() adjust = gp_template.get_def("account_adjust").render() return create + reset + adjust