当前位置: 首页>>代码示例>>Python>>正文


Python GsuserManager.get_userprofile_by_id方法代码示例

本文整理汇总了Python中gitshell.gsuser.models.GsuserManager.get_userprofile_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python GsuserManager.get_userprofile_by_id方法的具体用法?Python GsuserManager.get_userprofile_by_id怎么用?Python GsuserManager.get_userprofile_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gitshell.gsuser.models.GsuserManager的用法示例。


在下文中一共展示了GsuserManager.get_userprofile_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: notif_pull_request_status

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def notif_pull_request_status(self, pullRequest, pullStatus):
     notif_type = NOTIF_TYPE.MERGE_CREATE_PULL_REQUEST
     message = ''
     if pullStatus == PULL_STATUS.NEW:
         message = u'新建了'
         merge_user_profile = GsuserManager.get_userprofile_by_id(pullRequest.merge_user_id)
         if merge_user_profile is not None:
             notifMessage = NotifMessage.create(NOTIF_CATE.MERGE, NOTIF_TYPE.MERGE_CREATE_PULL_REQUEST, pullRequest.pull_user_id, pullRequest.merge_user_id, pullRequest.id)
             notifMessage.message = message
             self.message_save_and_notif(notifMessage)
         merge_user_profile.unread_message = merge_user_profile.unread_message + 1
         merge_user_profile.save()
         return
     if pullStatus == PULL_STATUS.MERGED_FAILED:
         notif_type = NOTIF_TYPE.MERGE_MERGED_FAILED_PULL_REQUEST
         message = u'合并失败'
     elif pullStatus == PULL_STATUS.MERGED:
         notif_type = NOTIF_TYPE.MERGE_MERGED_PULL_REQUEST
         message = u'合并了'
     elif pullStatus == PULL_STATUS.REJECTED:
         notif_type = NOTIF_TYPE.MERGE_REJECTED_PULL_REQUEST
         message = u'拒绝了'
     elif pullStatus == PULL_STATUS.CLOSE:
         notif_type = NOTIF_TYPE.MERGE_CLOSE_PULL_REQUEST
         message = u'关闭了'
     pull_user_profile = GsuserManager.get_userprofile_by_id(pullRequest.pull_user_id)
     if pull_user_profile is not None:
         notifMessage = NotifMessage.create(NOTIF_CATE.MERGE, notif_type, pullRequest.merge_user_id, pullRequest.pull_user_id, pullRequest.id)
         notifMessage.message = message
         self.message_save_and_notif(notifMessage)
     pull_user_profile.unread_message = pull_user_profile.unread_message + 1
     pull_user_profile.save()
开发者ID:ZheYuan,项目名称:gitshell,代码行数:34,代码来源:models.py

示例2: list_teamMember_by_teamUserId

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def list_teamMember_by_teamUserId(self, team_user_id):
     userprofile = GsuserManager.get_userprofile_by_id(team_user_id)
     if userprofile.is_team_account == 0:
         return []
     teamMembers = query(TeamMember, team_user_id, 'teammember_l_teamUserId', [team_user_id])
     for x in teamMembers:
         x.user = GsuserManager.get_userprofile_by_id(x.user_id)
         x.team_user = userprofile
     return teamMembers
开发者ID:ZheYuan,项目名称:gitshell,代码行数:11,代码来源:models.py

示例3: list_teamMember_by_userId

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def list_teamMember_by_userId(self, user_id):
     userprofile = GsuserManager.get_userprofile_by_id(user_id)
     if userprofile.has_joined_team == 0:
         return []
     teamMembers = query(TeamMember, None, 'teammember_l_userId', [user_id])
     for x in teamMembers:
         x.user = GsuserManager.get_userprofile_by_id(x.user_id)
         x.team_user = GsuserManager.get_userprofile_by_id(x.team_user_id)
     return teamMembers
开发者ID:ZheYuan,项目名称:gitshell,代码行数:11,代码来源:models.py

示例4: fillwith

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def fillwith(self):
     self.repo = RepoManager.get_repo_by_id(self.repo_id)
     self.creator_userprofile = GsuserManager.get_userprofile_by_id(self.creator_user_id)
     self.assigned_userprofile = GsuserManager.get_userprofile_by_id(self.assigned)
     if self.tracker in ISSUE_ATTRS['REV_TRACKERS']:
         self.tracker_v = ISSUE_ATTRS['REV_TRACKERS'][self.tracker]
     if self.status in ISSUE_ATTRS['REV_STATUSES']:
         self.status_v = ISSUE_ATTRS['REV_STATUSES'][self.status]
     if self.priority in ISSUE_ATTRS['REV_PRIORITIES']:
         self.priority_v = ISSUE_ATTRS['REV_PRIORITIES'][self.priority]
开发者ID:ZheYuan,项目名称:gitshell,代码行数:12,代码来源:models.py

示例5: get_teamMember_by_teamUserId_userId

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def get_teamMember_by_teamUserId_userId(self, team_user_id, user_id):
     # for team user global permission
     if team_user_id == 0:
         teamMember = query_first(TeamMember, team_user_id, 'teammember_s_teamUserId_userId', [team_user_id, user_id])
         return teamMember
     team_userprofile = GsuserManager.get_userprofile_by_id(team_user_id)
     if team_userprofile and team_userprofile.is_team_account == 0:
         return None
     teamMember = query_first(TeamMember, team_user_id, 'teammember_s_teamUserId_userId', [team_user_id, user_id])
     if not teamMember:
         return None
     teamMember.user = GsuserManager.get_userprofile_by_id(user_id)
     teamMember.team_user = team_userprofile
     return teamMember
开发者ID:ZheYuan,项目名称:gitshell,代码行数:16,代码来源:models.py

示例6: notif_at

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
    def notif_at(self, notif_type, from_user_id, relative_id, message):
        at_name_list = FeedUtils.list_atname(message)
        user_unread_message_dict = {}

        for at_name in at_name_list:
            at_user = GsuserManager.get_user_by_name(at_name)
            if at_user is not None:
                to_user_id = at_user.id
                notifMessage = None
                # disable duplicate notify
                exists_notifMessage = self.get_notifmessage_by_userId_notifType_relativeId(to_user_id, notif_type, relative_id)
                if exists_notifMessage is not None:
                    continue
                if notif_type == NOTIF_TYPE.AT_COMMIT:
                    notifMessage = NotifMessage.create_at_commit(from_user_id, to_user_id, relative_id)
                elif notif_type == NOTIF_TYPE.AT_MERGE:
                    notifMessage = NotifMessage.create_at_merge(from_user_id, to_user_id, relative_id)
                elif notif_type == NOTIF_TYPE.AT_ISSUE:
                    notifMessage = NotifMessage.create_at_issue(from_user_id, to_user_id, relative_id)
                elif notif_type == NOTIF_TYPE.AT_ISSUE_COMMENT:
                    notifMessage = NotifMessage.create_at_issue_comment(from_user_id, to_user_id, relative_id)
                if notifMessage is None:
                    continue
                self.message_save_and_notif(notifMessage)
                if to_user_id not in user_unread_message_dict:
                    user_unread_message_dict[to_user_id] = 0
                user_unread_message_dict[to_user_id] = user_unread_message_dict[to_user_id] + 1

        for to_user_id, unread_message in user_unread_message_dict.items():
            at_userprofile = GsuserManager.get_userprofile_by_id(to_user_id)
            at_userprofile.unread_message = at_userprofile.unread_message + unread_message
            at_userprofile.save()
开发者ID:ZheYuan,项目名称:gitshell,代码行数:34,代码来源:models.py

示例7: watch_user

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def watch_user(request, user_name):
    title = u'%s / 关注的用户' % user_name
    gsuser = GsuserManager.get_user_by_name(user_name)
    if gsuser is None:
        raise Http404
    gsuserprofile = GsuserManager.get_userprofile_by_id(gsuser.id)

    feedAction = FeedAction()
    raw_watch_users = feedAction.get_watch_users(gsuser.id, 0, 100)
    watch_user_ids = [int(x[0]) for x in raw_watch_users]
    watch_users_map = GsuserManager.map_users(watch_user_ids)
    watch_users = [watch_users_map[x] for x in watch_user_ids if x in watch_users_map]

    raw_bewatch_users = feedAction.get_bewatch_users(gsuser.id, 0, 100)
    bewatch_user_ids = [int(x[0]) for x in raw_bewatch_users]
    bewatch_users_map = GsuserManager.map_users(bewatch_user_ids)
    bewatch_users = [bewatch_users_map[x] for x in bewatch_user_ids if x in bewatch_users_map]
    # fixed on detect
    need_fix = False
    if len(watch_users) != gsuserprofile.watch:
        gsuserprofile.watch = len(watch_users)
        need_fix = True
    if len(bewatch_users) < 100 and len(bewatch_users) != gsuserprofile.be_watched:
        gsuserprofile.be_watched = len(bewatch_users) 
        need_fix = True
    if need_fix:
        gsuserprofile.save()

    response_dictionary = {'mainnav': 'user', 'title': title, 'watch_users': watch_users, 'bewatch_users': bewatch_users}
    response_dictionary.update(get_common_user_dict(request, gsuser, gsuserprofile))
    return render_to_response('user/watch_user.html',
                          response_dictionary,
                          context_instance=RequestContext(request))
开发者ID:ZheYuan,项目名称:gitshell,代码行数:35,代码来源:views.py

示例8: get_userprofile

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def get_userprofile(request):
    if not hasattr(request, '_cached_userprofile'):
        if request.user.is_authenticated():
            request._cached_userprofile = GsuserManager.get_userprofile_by_id(request.user.id)
        else:
            request._cached_userprofile = Userprofile()
    return request._cached_userprofile
开发者ID:ZheYuan,项目名称:gitshell,代码行数:9,代码来源:middleware.py

示例9: update_user_repo_quote

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def update_user_repo_quote(self, user, repo, diff_size):
     userprofile = GsuserManager.get_userprofile_by_id(user.id)
     userprofile.used_quote = userprofile.used_quote + diff_size
     repo.used_quote = repo.used_quote + diff_size
     if userprofile.used_quote < 0:
         userprofile.used_quote = 0
     if repo.used_quote < 0:
         repo.used_quote = 0
     userprofile.save()
     repo.save()
开发者ID:ZheYuan,项目名称:gitshell,代码行数:12,代码来源:models.py

示例10: groups

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def groups(request, username):
    teamUser = GsuserManager.get_user_by_name(username)
    teamUserprofile = GsuserManager.get_userprofile_by_id(teamUser.id)
    teamGroups = TeamManager.list_teamGroup_by_teamUserId(teamUser.id)
    current = 'settings'; sub_nav = 'groups'; title = u'%s / 设置 / 组管理' % (teamUser.username)
    response_dictionary = {'current': current, 'sub_nav': sub_nav, 'title': title, 'teamGroups': teamGroups}
    response_dictionary.update(_get_common_team_dict(request, teamUser, teamUserprofile))
    return render_to_response('team/groups.html',
                          response_dictionary,
                          context_instance=RequestContext(request))
开发者ID:ZheYuan,项目名称:gitshell,代码行数:12,代码来源:views.py

示例11: get_permissionItem_by_setId_userId

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def get_permissionItem_by_setId_userId(self, set_id, user_id):
     if set_id == 0:
         return None
     permissionItem = query_first(PermissionItem, set_id, 'permissionitem_s_setId_userId', [set_id, user_id])
     if not permissionItem:
         return None
     permissionItem.userprofile = GsuserManager.get_userprofile_by_id(permissionItem.user_id)
     if permissionItem.permission in PERMISSION.VIEW:
         permissionItem.permission_view = PERMISSION.VIEW[permissionItem.permission]
     return permissionItem
开发者ID:ZheYuan,项目名称:gitshell,代码行数:12,代码来源:models.py

示例12: stats

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def stats(request, user_name):
    user = GsuserManager.get_user_by_name(user_name)
    if user is None:
        raise Http404
    stats_dict = get_stats_dict(request, user)
    gsuserprofile = GsuserManager.get_userprofile_by_id(user.id)
    response_dictionary = {'title': u'%s / 最近统计' % (user.username), 'gsuserprofile': gsuserprofile}
    response_dictionary.update(stats_dict)
    return render_to_response('user/stats.html',
                          response_dictionary,
                          context_instance=RequestContext(request))
开发者ID:ZheYuan,项目名称:gitshell,代码行数:13,代码来源:views.py

示例13: _get_team_user_userprofile

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def _get_team_user_userprofile(request, username):
    current_user = GsuserManager.get_user_by_name(username)
    if not current_user:
        return (request.user, request.userprofile)
    teamMember = TeamManager.get_teamMember_by_teamUserId_userId(current_user.id, request.user.id)
    if not teamMember:
        return (request.user, request.userprofile)
    current_userprofile = GsuserManager.get_userprofile_by_id(current_user.id)
    if current_userprofile:
        return (current_user, current_userprofile)
    return (request.user, request.userprofile)
开发者ID:ZheYuan,项目名称:gitshell,代码行数:13,代码来源:views.py

示例14: add_member

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
 def add_member(self, repo, user):
     if repo is None or user is None or repo.user_id == user.id:
         return None
     userprofile = GsuserManager.get_userprofile_by_id(user.id)
     userprofile.has_joined_repo = 1
     userprofile.save()
     repoMember = self.get_repo_member(repo.id, user.id)
     if repoMember is None:
         repoMember = RepoMember()
         repoMember.repo_id = repo.id
         repoMember.user_id = user.id
         repoMember.save()
开发者ID:ZheYuan,项目名称:gitshell,代码行数:14,代码来源:models.py

示例15: get_attrs

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_userprofile_by_id [as 别名]
def get_attrs(username, reponame):
    user = GsuserManager.get_user_by_name(username)
    if not user:
        return_all_none()
    userprofile = GsuserManager.get_userprofile_by_id(user.id)
    if not userprofile:
        return_all_none()
    repo = RepoManager.get_repo_by_userId_name(user.id, reponame)
    if not repo:
        return_all_none()
    abs_repo_path = repo.get_abs_repopath()
    return (user, userprofile, repo, abs_repo_path)
开发者ID:ZheYuan,项目名称:gitshell,代码行数:14,代码来源:hookworker.py


注:本文中的gitshell.gsuser.models.GsuserManager.get_userprofile_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。