def POST(self): i = web.input('username', 'passwd', 'carrera', 'inid', 'inim', 'iniy', nombre = '', padron = '') username = filterstr(i.username) username = username.lower() passwd = filterstr(i.passwd) ret = server.register(username, passwd) if ret != 0: raise web.seeother('register?error=1') sid = server.auth(username, passwd) personal = server.get_personal(sid) personal['nombre'] = i.nombre personal['padron'] = i.padron personal['carrera'] = i.carrera personal['hace_tesis'] = 0 personal['inicio'] = (int(i.inid), int(i.inim), int(i.iniy)) personal['area'] = server.get_areas(i.carrera).keys()[0] ret = server.set_personal(sid, personal) if not ret: print personal print ret # XXX: (?) Ver que es esto... return raise web.seeother('register?error=2') raise web.seeother('login?register_ok=1')
def GET(self): sid = web.cookies('sid')['sid'] i = web.input(action_ok = 0) action_ok = i.action_ok personal = server.get_personal(sid) areas = server.get_areas(personal['carrera']).items() return render_in_context.personal(action_ok = action_ok, personal = personal, areas = areas)
def GET(self): sid = web.cookies('sid')['sid'] personal = server.get_personal(sid) inicio = personal['inicio'] carrera_desc = server.get_carreras()[personal['carrera']] areas = server.get_areas(personal['carrera']) area_desc = areas[personal['area']] del areas cursando = server.get_cursando(sid).items() cursando.sort() para_cursar = server.get_para_cursar(sid).items() para_cursar.sort() apro_dict = server.get_aprobadas(sid) promedio = 0.0 aprobadas = [] for key in apro_dict: aprobadas.append([key] + apro_dict[key]) promedio += apro_dict[key][0] if len(aprobadas): promedio = promedio / len(aprobadas) promedio = "%.2f" % promedio aprobadas.sort() creditos = 0 for key in apro_dict: info = server.get_info_materia(personal['carrera'], key) creditos += info['creditos'] cantaprobadas = len(aprobadas) return render_in_context.index(personal = personal, area_desc = area_desc, carrera_desc = carrera_desc, inicio = inicio, promedio = promedio, creditos = creditos, cantaprobadas = cantaprobadas, cursando = cursando, para_cursar = para_cursar, aprobadas = aprobadas)