def POST(self): validateInstructor() instr = getUsername() wi = web.input() allsections = control.getSections() selection=[] for i in wi: if i in allsections: selection.append(i) for j in allsections: if j in selection: control.assignInstructor(instr,j) #else: #control.assignInstructor("",j) #this bug prevents multiple instructors raise web.seeother('/instructor/')
def GET(self): validateInstructor() instr = getUsername() allsections = control.getSections() print allsections for i in allsections:#repopulate section list in case of roster change control.addSection(i) allsections.sort() yoursections = control.getInstrSections(instr) formguts = [] for i in allsections: insec = (i in yoursections) entry = form.Checkbox(name=i,value="1",checked=insec) formguts.append(entry) butt = form.Button(name="button", type="submit", value="Select sections") formguts.append(butt) f = form.Form(*formguts) #asterisk passes entries as arguments return render.manage(bootpre,f)