コード例 #1
0
 def get_by_email(cls, email):
     """
     given an email it returns the  user object of the email given or raises an exception if the user is not found
     :param email: email of the user to find
     :return: user object
     """
     user = Database.find_one(COLLECTION, {"email": email})
     if user:
         return cls(**user)
     raise UserNotFoundException("El usuario con el correo dado no existe")
コード例 #2
0
 def get_by_id(cls, _id):
     user = Database.find_one(COLLECTION, {'_id': _id})
     if user:
         return cls(**user)
コード例 #3
0
 def get_by_id(cls, _id):
     user = Database.find_one(COLLECTION, {'_id': _id})
     if user:
         return cls(**user)
     raise UserNotFoundException(
         "El usuario con el token / id dado no existe.")