def get_profile_by_nick(nick): user = None exception = False try: user = CsUser.filter(nick=nick).first() except Exception, ex: exception = True logging.exception(ex) sentry_client.captureException()
def user_list_from_ids(ids, dict=True): temp_user = CsUser.filter(CsUser.id.in_(set(ids))).limit(50) if dict: user_list = [] for u in temp_user: d = u._as_dict() extras = u.extended d.update(**extras) user_list.append(d) return user_list else: return temp_user
def get_profile_by_nick(nick): user = CsUser.filter(nick=nick).first() if user is None: return return load_user(user.id)
su.blog = github_user.get("blog") su.ext_id = github_user.get("id") su.name = github_user.get("name", "") su.hireable = github_user.get("hireable", False) su.access_token = access_token u.social_accounts.append(su) db.session.add(u) try: db.session.commit() except Exception, e: logging.warn(e) db.session.rollback() finally: CsUser.create(id=u.id, nick=u.nick, extended=dict(pic=u.pic_url)) return u # TODO: Create a task to fetch all the other information.. # starred = user.get_starred() # for s in starred: # print s.full_name, s.watchers # pub_events = user.get_public_events() # for e in pub_events: # print e.id, e.type, e.repo.full_name
def get_user_discussion_by_nick(nick): try: user = CsUser.filter(nick=nick).first() except DoesNotExist, dne: user = None
su.ext_id = github_user.get("id") su.name = github_user.get("name", "") su.hireable = github_user.get("hireable", False) su.access_token = access_token u.social_accounts.append(su) db.session.add(u) try: db.session.commit() except Exception, e: logging.warn(e) db.session.rollback() sentry_client.captureException() finally: CsUser.create(id=u.id, nick=u.nick, extended=dict(pic=u.pic_url)) try: notification = u"Id:{} Nick:[{}] Name:[{}] Email:[{}] Followers:{}".format( u.id, user_login, name, email, github_user.get("followers", 0)) worker_queue.enqueue(notify_registration, args=(notification, ), result_ttl=0) except Exception, ex: logging.exception(ex) sentry_client.captureException() return u # TODO: Create a task to fetch all the other information..
def get_user_timeline_by_nick(nick): try: user = CsUser.filter(nick=nick).first() except DoesNotExist, dne: user = None