Skip to content

Instantly share code, notes, and snippets.

@spiralswimmer spiralswimmer/potty.py Secret
Created May 18, 2018

Embed
What would you like to do?
💩
def __get_user(self, userid=None, email=None, phone=None, fbid=None):
ret_u = None
if fbid == None and phone == None and email == None and userid == None:
return None
if userid:
q = {'userid': userid}
users = self.db.find_cfg_coll('dbname', 'users', q)
for u in users:
ret_u = u
break
if ret_u == None and fbid:
q = {'fb.id': fbid}
users = self.db.find_cfg_coll('dbname', 'users', q)
for u in users:
ret_u = u
break
if ret_u == None and phone:
q = {'info.phone': phone}
users = self.db.find_cfg_coll('dbname', 'users', q)
for u in users:
ret_u = u
break
if ret_u == None and email:
q = {'info.email': email}
users = self.db.find_cfg_coll('dbname', 'users', q)
for u in users:
ret_u = u
break
if ret_u and 'info' in ret_u and 'fb' in ret_u and 'id' in ret_u['fb']:
ret_u['info']['picture'] = fb.get_fb_picture(ret_u['fb']['id'])
# adding some profile keys
if ret_u and 'personal_profile' not in ret_u.keys():
ret_u['personal_profile'] = USER_PROFILE_KEYS
return ret_u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.