def post(self) : """ Handles adding grades to a course. """ key = self.request.get('key') course = db.get(db.Key(key)) session = getSessionByRequest(self) user = getSessionUser(session) da = DataAccessor() if (not self.request.get('grade')) : query = DS.Grade.all().filter('course =', course) query.filter('student =', user) grade = query.get() da.delete(grade) setSessionMessage(session, "Removed your grade", False) self.redirect('/ratable/%s' % key) return da.addGrade(course, getSessionUser(session), self.request.get('grade')) setSessionMessage(session, "Added your grade.", False) self.redirect('/ratable/%s' % key)
def get(self) : """ Deletes the current user. """ session = getSessionByRequest(self) user = getSessionUser(session) da = DataAccessor() da.delete(user) expireSession(session) self.redirect('/browse/')
def get(self, key=None): """ Deletes the user in question. """ DA = DataAccessor() if key == "all": for u in DA.getStudents(): DA.delete(u) elif key: user = db.get(db.Key(key)) DA.delete(user) self.redirect("/admin/manageUsers")
def get(self) : """ Deletes the object that has been stored in the session. """ session = getSessionByRequest(self) if session.deletionTarget : da = DataAccessor() da.delete(session.deletionTarget) ratable = unify(session.deletionTarget.rated) setSessionMessage(session, "You have deleted " + ratable.name + ".") session.deletionTarget = None session.put() else : setSessionMessage(session, "Invalid request.", True) self.redirect('/student/')