def retrieve(self): credentials = credentials_parser.parse_args() # @UndefinedVariable user = User.get(credentials['username']) if not user: return {"detail": "Not found"}, 404 if not user.check_password(credentials['password']): return {"detail": "Forbidden"}, 403 token = Token(user) token.save() return marshal(token, token_fields)
def run(self, username): u = User.get(username) if u: u.delete() else: print "User with given username not found"
def run(self, username, password, is_admin=False): if User.get(username): print "User with given username already exists" else: user = User(username, password) user.save()