-
-
Save spiralswimmer/526a302d2ea883dd06e8dfcff05ae911 to your computer and use it in GitHub Desktop.
💩
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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