Exemplo n.º 1
0
 def find(self, user_profile):
     if isinstance(user_profile, str):
         user_profile = json.loads(user_profile)
     try:
         user = rds.People().query.filter_by(user_id=user_profile["user_id"].get("value")).one()
     except NoResultFound:
         user = None
     return user
Exemplo n.º 2
0
Arquivo: user.py Projeto: romanom/cis
    def update(self, user_profile):
        if isinstance(user_profile, str):
            user_profile = json.loads(user_profile)

        user = self.find(user_profile)
        user.user_id = user_profile["user_id"].get("value")
        user.primary_email = user_profile["primary_email"].get("value")
        user.profile = user_profile
        user.user_uuid = user_profile["uuid"].get("value")
        user.primary_username = user_profile["primary_username"].get("value")
        user.sequence_number = str(uuid.uuid4().int)
        self.scoped_session.add(user)
        self.scoped_session.commit()
        return rds.People().query.filter_by(user_id=user.user_id).one()
Exemplo n.º 3
0
Arquivo: user.py Projeto: romanom/cis
 def find_by_id(self, user_id):
     try:
         user = rds.People().query.filter_by(user_id=user_id).one()
     except NoResultFound:
         user = None
     return user