def _login_redirect(self, status_): key = self._next_key_gen() c = Cache() value = c.findby_key(key) if value: next = escape.utf8(value["value"]) c.remove(value["_id"]) else: next = "/" #next = self.get_argument("next", "/") if status_ == const.Status.INIT: self.redirect("/user/profile?next=%s" % next) else: self.redirect(next)
def remove(key): """Remove a cache's value.""" c = Cache() v = c.findby_key(key) if v: c.remove(v["_id"])