def get(self): colleges = model.get_colleges() departments = model.get_departments() courses = model.get_courses() dep_name = departments[0] dep_id = departments[1] dep_college = departments[2] cour_name = courses[0] cour_id = courses[1] cour_department = courses[2] upload_url = blobstore.create_upload_url('/upload/submit') template_values = { 'colleges': colleges, 'departments_name' : simplejson.dumps(dep_name), 'departments_id' : simplejson.dumps(dep_id), 'departments_college' : simplejson.dumps(dep_college), 'courses_name' : simplejson.dumps(cour_name), 'courses_id' : simplejson.dumps(cour_id), 'courses_department' : simplejson.dumps(cour_department), 'action': upload_url } path = os.path.join(os.path.dirname(__file__), 'html/upload.html') self.response.out.write(template.render(path, template_values))
def act(self): courses = model.get_courses(self._option) view = View.factory(View._course) option = view.show_list(courses) if option == None: return None elif option == View._back: return View._back else: return View._mural, option
def get(self): colleges = model.get_colleges() departments = model.get_departments() courses = model.get_courses() dep_name = departments[0] dep_id = departments[1] dep_college = departments[2] cour_name = courses[0] cour_id = courses[1] cour_department = courses[2] template_values = { 'colleges': colleges, 'departments_name' : simplejson.dumps(dep_name), 'departments_id' : simplejson.dumps(dep_id), 'departments_college' : simplejson.dumps(dep_college), 'courses_name' : simplejson.dumps(cour_name), 'courses_id' : simplejson.dumps(cour_id), 'courses_department' : simplejson.dumps(cour_department) } path = os.path.join(os.path.dirname(__file__), 'html/taskbook.html') self.response.out.write(template.render(path, template_values))
def GET(self): model.insert_view(web.ctx.host + web.ctx.fullpath, web.ctx.status, web.ctx.ip, web.ctx.env['HTTP_USER_AGENT'] if 'HTTP_USER_AGENT' in web.ctx.env else None, "GET") web.header('Content-Type', 'application/json') web.header('Access-Control-Allow-Origin', '*') data = web.input() limit = utilities.get_limit(data) offset = utilities.get_offset(data) department = "" reviews = False if not utilities.is_int(limit): return limit if not utilities.is_int(offset): return offset if 'department' in data: if len(data['department']) != 4: return utilities.api_error("department parameter must be 4 characters") department = data['department'] if not model.department_has_course(department): return utilities.api_error("no courses found with that department") if 'reviews' in data: if not data['reviews'] in utilities.TRUE_FALSE: return utilities.api_error("reviews parameter must be either true or false") if data['reviews'] == 'true': reviews = True courses = model.get_courses(limit, offset, department, reviews) return json.dumps(list(courses))