def responseInvalidSession(self): meta = getEmptyMetaDict() data = {} meta["status"] = "failure" meta["message"] = "Session is timeout" meta["error_code"] = kErrorInvalidSession self.dumpJSON(getFullResponseDictionary(meta, data))
def responseInvalidPassword(self): meta = getEmptyMetaDict() data = {} meta["status"] = "failure" meta["message"] = "Invalid Userid/Password" meta["error_code"] = kErrorInvalidUserPassword self.dumpJSON(getFullResponseDictionary(meta, data))
def responseInvalidSid(self): meta = getEmptyMetaDict() data = {} meta["status"] = "failure" meta["message"] = "Invalid sid" meta["error_code"] = kErrorInvalidSID self.dumpJSON(getFullResponseDictionary(meta, data))
def activateOperation(self): meta = getEmptyMetaDict() if self.checkKey(): meta["status"] = "success" else: meta["status"] = "failure" self.dumpJSON(getFullResponseDictionary(meta, {}))
def logoutOperation(self): meta = getEmptyMetaDict() data = {} if self.checkKey(): sid = self.request.get("sid") global sessionStore if sessionStore.find(sid): userid = sessionStore.getUserID(sid) session = sessionStore.getSession(sid) session.logout() if sessionStore.removeWithSID(sid): sessionStore.printOut() meta["status"] = "success" meta["message"] = "%s has logged out" % userid data["sid"] = sid else: meta["status"] = "failure" meta["message"] = "logout %s sid failed" % userid data["sid"] = sid self.dumpJSON(getFullResponseDictionary(meta, data)) else: self.responseInvalidSid() else: self.responseInvalidKey()