def GET(self): dbase=Database() ath=Auth(dbase) if ath.checkAuth(): raise web.seeother('/map') tkn,new=dbase.user_exists(ath.getUserid()) if new == True: raise web.seeother("/onboard") env = Environment(loader=PackageLoader('html', '')) template = env.get_template('landing.html') return template.render()
def POST(self): dbase = Database() ath = Auth(dbase) if not ath.checkAuth(): raise web.seeother('/') inp = web.input(quest="badquesty") if inp["quest"] != "badquesty": q = Quest(dbase) q.getSched(inp["quest"], ath.getUserid()) dbase.user_setold(ath.getUserid()) raise web.seeother('/map') else: return "Please actually submit something." # redirect(CASLoginURL)
def getShareJs(self, name): """ start up a restful service that offer a js file that can link website to wechat offical account with desc and title :return: """ try: js = Auth().getJs(jsName=name) print "Request: successfully load js: " + name + " " + time.asctime( time.localtime(time.time())) return js except Exception, e: raise tornado.web.HTTPError(404)
def GET(self): dbase = Database() ath = Auth(dbase) if not ath.checkAuth(): raise web.seeother('/login') tkn, new = dbase.user_exists(ath.getUserid()) if new == True: raise web.seeother("/onboard") user_data = web.input(node="2016012246") nd1 = user_data.node pt = Paths(dbase) env = Environment(loader=PackageLoader('html', '')) template = env.get_template('maptest.html') classes = dbase.getDayClasses(ath.getUserid()) for cls in classes: x = classes.index(cls) if x == 0: classes[x].lastClassLoc = "b-E3" else: classes[x].lastClassLoc = classes[x - 1].build classes[x].class_name = classes[x].class_name.split(" - ")[0] classes[x].build = "b-" + cls.where.split(" ")[0] classes[x].timestamp = classes[x].timestamp.strftime("%I:%M %p") classes[x].timeend = classes[x].timeend.strftime("%I:%M %p") if cls.type == "LEC": classes[x].col = "warning" elif cls.type == "TST": classes[x].col = "danger" elif cls.type == "TUT": classes[x].col = "info" elif cls.type == "LAB": classes[x].col = "success" elif cls.type == "SEM": classes[x].col = "warning" xs = [] pth = [] for el in pt.getPath(nd1, "b-E3"): node = dbase.getNode(el) pth.append([node.x, node.y]) xs.append(node) return template.render(vertices=xs, path=pth, classes=classes, qr_data=ath.getUserid() + ":" + ath.getUserToken())