def GET(self): i = web.input(pid=None, cid=None, opt="") option = i.pop('opt') try: # getting the requested paper i.pid = int(i.pid) paper = Paper(i.pid) if not paper.enabled: raise except (TypeError, IndexError): raise web.notfound() try: # getting the specified comment i.cid = int(i.cid) comment = paper.comments[i.cid] if not comment['enabled']: raise IndexError except (TypeError, IndexError): return render().item(paper) if option and comment['username'] == session()['uname'] \ and session()['logged']: # TODO: or session()['admin'] if option == "delete": paper.activate_comment(i.cid, state=False) return render().item(paper) if option == "edit": return render().edit(i.pid, i.cid, comment) return render().comment(i.pid, i.cid, comment)