• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.group_is_public函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.web.helpers.group_is_public函数的典型用法代码示例。如果您正苦于以下问题:Python group_is_public函数的具体用法?Python group_is_public怎么用?Python group_is_public使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_public_group_returns_true_with_missing_project

 def test_public_group_returns_true_with_missing_project(self, get_project_list):
     get_project_list.return_value = {}
     self.group.is_public = True
     self.user.is_superuser = False
     result = group_is_public(self.group, self.user)
     assert result is True
     get_project_list.assert_called_once_with(self.user)
开发者ID:hellove1985,项目名称:sentry,代码行数:7,代码来源:tests.py


示例2: test_public_group_returns_false_with_project_membership

 def test_public_group_returns_false_with_project_membership(self, get_project_list):
     get_project_list.return_value = {self.group.project.id: self.group.project}
     self.group.is_public = True
     self.user.is_superuser = False
     result = group_is_public(self.group, self.user)
     assert result is False
     get_project_list.assert_called_once_with(self.user)
开发者ID:hellove1985,项目名称:sentry,代码行数:7,代码来源:tests.py


示例3: get_rendered_interfaces

def get_rendered_interfaces(event, request):
    interface_list = []
    is_public = group_is_public(event.group, request.user)
    for interface in event.interfaces.itervalues():
        html = safe_execute(interface.to_html, event, is_public=is_public)
        if not html:
            continue
        interface_list.append((interface, mark_safe(html)))
    return sorted(interface_list, key=lambda x: x[0].get_display_score(), reverse=True)
开发者ID:AnguelSC,项目名称:sentry,代码行数:9,代码来源:sentry_helpers.py


示例4: _get_entries

    def _get_entries(self, request, event):
        # XXX(dcramer): These are called entries for future-proofing
        is_public = group_is_public(event.group, request.user)

        interface_list = []
        for interface in event.interfaces.itervalues():
            entry = {
                'data': interface.get_json_context(),
                'type': interface.get_type_name(),
            }
            interface_list.append((interface, entry))
        interface_list.sort(key=lambda x: x[0].get_display_score(), reverse=True)

        return [i[1] for i in interface_list]
开发者ID:catufunwa,项目名称:sentry,代码行数:14,代码来源:event_details.py


示例5: group

def group(request, team, project, group):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event()
    event.group = group

    context = {'page': 'details'}

    if group_is_public(group, request.user):
        template = 'sentry/groups/public_details.html'
        context['PROJECT_LIST'] = [project]
    else:
        template = 'sentry/groups/details.html'

    return render_with_group_context(group, template, context, request, event=event)
开发者ID:TracyWebTech,项目名称:sentry,代码行数:15,代码来源:groups.py


示例6: group

def group(request, team, project, group, event_id=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    activity_qs = Activity.objects.order_by('-datetime').select_related('user')
    if event_id:
        event = get_object_or_404(group.event_set, id=event_id)
        activity_qs = activity_qs.filter(
            Q(event=event) | Q(event__isnull=True),
        )
    else:
        event = group.get_latest_event() or Event()

    # bind params to group in case they get hit
    event.group = group
    event.project = project

    # filter out dupes
    activity_items = set()
    activity = []
    for item in activity_qs.filter(group=group)[:10]:
        sig = (item.event_id, item.type, item.ident, item.user_id)
        if sig not in activity_items:
            activity_items.add(sig)
            activity.append(item)

    # trim to latest 5
    activity = activity[:5]

    context = {
        'page': 'details',
        'activity': activity,
    }

    is_public = group_is_public(group, request.user)

    if is_public:
        template = 'sentry/groups/public_details.html'
        context['PROJECT_LIST'] = [project]
    else:
        template = 'sentry/groups/details.html'

    return render_with_group_context(
        group, template, context, request,
        event=event, is_public=is_public)
开发者ID:gaojiashenghim,项目名称:sentry,代码行数:44,代码来源:groups.py


示例7: group

def group(request, team, project, group):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    event = group.get_latest_event() or Event()
    event.group = group

    activity = list(Activity.objects.filter(
        group=group,
    ).order_by('-datetime').select_related('user')[:10])

    context = {
        'page': 'details',
        'activity': activity,
    }

    if group_is_public(group, request.user):
        template = 'sentry/groups/public_details.html'
        context['PROJECT_LIST'] = [project]
    else:
        template = 'sentry/groups/details.html'

    return render_with_group_context(group, template, context, request, event=event)
开发者ID:askfor,项目名称:sentry,代码行数:22,代码来源:groups.py


示例8: test_anonymous_user

 def test_anonymous_user(self):
     self.group.is_public = True
     result = group_is_public(self.group, AnonymousUser())
     assert result is True
开发者ID:hellove1985,项目名称:sentry,代码行数:4,代码来源:tests.py


示例9: test_superuser_is_false_with_missing_project

 def test_superuser_is_false_with_missing_project(self):
     self.group.is_public = True
     self.user.is_superuser = True
     result = group_is_public(self.group, self.user)
     assert result is False
开发者ID:hellove1985,项目名称:sentry,代码行数:5,代码来源:tests.py


示例10: group_details

def group_details(request, organization, project, group, event_id=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    if event_id:
        event = get_object_or_404(group.event_set, id=event_id)
    else:
        event = group.get_latest_event() or Event()

    Event.objects.bind_nodes([event], 'data')
    GroupMeta.objects.populate_cache([group])

    # bind params to group in case they get hit
    event.group = group
    event.project = project

    if request.POST.get('o') == 'note' and request.user.is_authenticated():
        add_note_form = NewNoteForm(request.POST)
        if add_note_form.is_valid():
            add_note_form.save(event, request.user)
            return HttpResponseRedirect(request.path)
    else:
        add_note_form = NewNoteForm()

    if request.user.is_authenticated() and project.has_access(request.user):
        # update that the user has seen this group
        try:
            create_or_update(
                GroupSeen,
                group=group,
                user=request.user,
                project=project,
                values={
                    'last_seen': timezone.now(),
                }
            )
        except DatabaseError as exc:
            logging.warn(unicode(exc), exc_info=True)

    activity_qs = Activity.objects.filter(
        group=group,
    ).order_by('-datetime').select_related('user')

    # filter out dupe activity items
    activity_items = set()
    activity = []
    for item in activity_qs[:20]:
        sig = (item.event_id, item.type, item.ident, item.user_id)
        # TODO: we could just generate a signature (hash(text)) for notes
        # so there's no special casing
        if item.type == Activity.NOTE:
            activity.append(item)
        elif sig not in activity_items:
            activity_items.add(sig)
            activity.append(item)

    activity.append(Activity(
        project=project, group=group, type=Activity.FIRST_SEEN,
        datetime=group.first_seen))

    # trim to latest 5
    activity = activity[:7]

    seen_by = sorted(filter(lambda ls: ls[0] != request.user and ls[0].email, [
        (gs.user, gs.last_seen)
        for gs in GroupSeen.objects.filter(
            group=group
        ).select_related('user')
    ]), key=lambda ls: ls[1], reverse=True)
    seen_by_extra = len(seen_by) - 5
    if seen_by_extra < 0:
        seen_by_extra = 0
    seen_by_faces = seen_by[:5]

    context = {
        'add_note_form': add_note_form,
        'page': 'details',
        'activity': activity,
        'seen_by': seen_by,
        'seen_by_faces': seen_by_faces,
        'seen_by_extra': seen_by_extra,
    }

    is_public = group_is_public(group, request.user)

    if is_public:
        template = 'sentry/groups/public_details.html'
        context['PROJECT_LIST'] = [project]
    else:
        template = 'sentry/groups/details.html'

    return render_with_group_context(
        group, template, context, request,
        event=event, is_public=is_public)
开发者ID:vperron,项目名称:sentry,代码行数:93,代码来源:groups.py


示例11: group

def group(request, team, project, group, event_id=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    if event_id:
        event = get_object_or_404(group.event_set, id=event_id)
    else:
        event = group.get_latest_event() or Event()

    Event.objects.bind_nodes([event], "data")

    # bind params to group in case they get hit
    event.group = group
    event.project = project

    if request.POST.get("o") == "note" and request.user.is_authenticated():
        add_note_form = NewNoteForm(request.POST)
        if add_note_form.is_valid():
            add_note_form.save(event, request.user)
            return HttpResponseRedirect(request.path)
    else:
        add_note_form = NewNoteForm()

    if project in Project.objects.get_for_user(request.user, team=team, superuser=False):
        # update that the user has seen this group
        create_or_update(
            GroupSeen, group=group, user=request.user, project=project, defaults={"last_seen": timezone.now()}
        )

    activity_qs = Activity.objects.filter(group=group).order_by("-datetime").select_related("user")

    # filter out dupe activity items
    activity_items = set()
    activity = []
    for item in activity_qs[:20]:
        sig = (item.event_id, item.type, item.ident, item.user_id)
        # TODO: we could just generate a signature (hash(text)) for notes
        # so there's no special casing
        if item.type == Activity.NOTE:
            activity.append(item)
        elif sig not in activity_items:
            activity_items.add(sig)
            activity.append(item)

    activity.append(Activity(project=project, group=group, type=Activity.FIRST_SEEN, datetime=group.first_seen))

    # trim to latest 5
    activity = activity[:7]

    seen_by = sorted(
        filter(
            lambda ls: ls[0] != request.user and ls[0].email,
            [(gs.user, gs.last_seen) for gs in GroupSeen.objects.filter(group=group).select_related("user")],
        ),
        key=lambda ls: ls[1],
        reverse=True,
    )
    seen_by_extra = len(seen_by) - 5
    if seen_by_extra < 0:
        seen_by_extra = 0
    seen_by_faces = seen_by[:5]

    context = {
        "add_note_form": add_note_form,
        "page": "details",
        "activity": activity,
        "seen_by": seen_by,
        "seen_by_faces": seen_by_faces,
        "seen_by_extra": seen_by_extra,
    }

    is_public = group_is_public(group, request.user)

    if is_public:
        template = "sentry/groups/public_details.html"
        context["PROJECT_LIST"] = [project]
    else:
        template = "sentry/groups/details.html"

    return render_with_group_context(group, template, context, request, event=event, is_public=is_public)
开发者ID:Getsidecar,项目名称:sentry,代码行数:79,代码来源:groups.py


示例12: test_non_public_group_returns_false

 def test_non_public_group_returns_false(self):
     self.group.is_public = False
     self.user.is_superuser = False
     result = group_is_public(self.group, self.user)
     assert result is False
开发者ID:hellove1985,项目名称:sentry,代码行数:5,代码来源:tests.py


示例13: group

def group(request, team, project, group, event_id=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    if event_id:
        event = get_object_or_404(group.event_set, id=event_id)
    else:
        event = group.get_latest_event() or Event()

    # bind params to group in case they get hit
    event.group = group
    event.project = project

    if request.POST.get('o') == 'note' and request.user.is_authenticated():
        add_note_form = NewNoteForm(request.POST)
        if add_note_form.is_valid():
            activity = Activity.objects.create(
                group=group, event=event, project=project,
                type=Activity.NOTE, user=request.user,
                data=add_note_form.cleaned_data
            )
            activity.send_notification()
            return HttpResponseRedirect(request.path)
    else:
        add_note_form = NewNoteForm()

    activity_qs = Activity.objects.order_by('-datetime').select_related('user')
    if event:
        activity_qs = activity_qs.filter(
            Q(event=event) | Q(event__isnull=True),
        )

    if project in Project.objects.get_for_user(
            request.user, team=team, superuser=False):
        # update that the user has seen this group
        create_or_update(
            GroupSeen,
            group=group,
            user=request.user,
            project=project,
            defaults={
                'last_seen': timezone.now(),
            }
        )

    # filter out dupe activity items
    activity_items = set()
    activity = []
    for item in activity_qs.filter(group=group)[:20]:
        sig = (item.event_id, item.type, item.ident, item.user_id)
        # TODO: we could just generate a signature (hash(text)) for notes
        # so theres no special casing
        if item.type == Activity.NOTE:
            activity.append(item)
        elif sig not in activity_items:
            activity_items.add(sig)
            activity.append(item)

    activity.append(Activity(
        project=project, group=group, type=Activity.FIRST_SEEN,
        datetime=group.first_seen))

    # trim to latest 5
    activity = activity[:7]

    seen_by = sorted(filter(lambda ls: ls[0] != request.user and ls[0].email, [
        (gs.user, gs.last_seen)
        for gs in GroupSeen.objects.filter(
            group=group
        ).select_related('user')
    ]), key=lambda ls: ls[1], reverse=True)
    seen_by_extra = len(seen_by) - 5
    if seen_by_extra < 0:
        seen_by_extra = 0
    seen_by_faces = seen_by[:5]

    context = {
        'add_note_form': add_note_form,
        'page': 'details',
        'activity': activity,
        'seen_by': seen_by,
        'seen_by_faces': seen_by_faces,
        'seen_by_extra': seen_by_extra,
    }

    is_public = group_is_public(group, request.user)

    if is_public:
        template = 'sentry/groups/public_details.html'
        context['PROJECT_LIST'] = [project]
    else:
        template = 'sentry/groups/details.html'

    return render_with_group_context(
        group, template, context, request,
        event=event, is_public=is_public)
开发者ID:dk-dev,项目名称:sentry,代码行数:95,代码来源:groups.py


示例14: group

def group(request, team, project, group, event_id=None):
    # It's possible that a message would not be created under certain
    # circumstances (such as a post_save signal failing)
    activity_qs = Activity.objects.order_by("-datetime").select_related("user")
    if event_id:
        event = get_object_or_404(group.event_set, id=event_id)
        activity_qs = activity_qs.filter(Q(event=event) | Q(event__isnull=True))
    else:
        event = group.get_latest_event() or Event()

    # bind params to group in case they get hit
    event.group = group
    event.project = project

    if project in Project.objects.get_for_user(request.user, team=team, superuser=False):
        # update that the user has seen this group
        create_or_update(
            GroupSeen, group=group, user=request.user, project=project, defaults={"last_seen": timezone.now()}
        )

    # filter out dupe activity items
    activity_items = set()
    activity = []
    for item in activity_qs.filter(group=group)[:10]:
        sig = (item.event_id, item.type, item.ident, item.user_id)
        if sig not in activity_items:
            activity_items.add(sig)
            activity.append(item)

    # trim to latest 5
    activity = activity[:5]

    seen_by = sorted(
        filter(
            lambda ls: ls[0] != request.user and ls[0].email,
            [(gs.user, gs.last_seen) for gs in GroupSeen.objects.filter(group=group).select_related("user")],
        ),
        key=lambda ls: ls[1],
        reverse=True,
    )
    seen_by_extra = len(seen_by) - 5
    if seen_by_extra < 0:
        seen_by_extra = 0
    seen_by_faces = seen_by[:5]

    context = {
        "page": "details",
        "activity": activity,
        "seen_by": seen_by,
        "seen_by_faces": seen_by_faces,
        "seen_by_extra": seen_by_extra,
    }

    is_public = group_is_public(group, request.user)

    if is_public:
        template = "sentry/groups/public_details.html"
        context["PROJECT_LIST"] = [project]
    else:
        template = "sentry/groups/details.html"

    return render_with_group_context(group, template, context, request, event=event, is_public=is_public)
开发者ID:berryp,项目名称:sentry,代码行数:62,代码来源:groups.py


示例15: test_anonymous_user

 def test_anonymous_user(self, get_project_list):
     get_project_list.return_value = []
     self.group.is_public = True
     result = group_is_public(self.group, AnonymousUser())
     assert result is True
开发者ID:nagyistoce,项目名称:sentry,代码行数:5,代码来源:tests.py


示例16: test_superuser_is_false_with_missing_project

 def test_superuser_is_false_with_missing_project(self, get_project_list):
     get_project_list.return_value = []
     self.group.is_public = True
     self.user.is_superuser = True
     result = group_is_public(self.group, self.user)
     assert result is False
开发者ID:nagyistoce,项目名称:sentry,代码行数:6,代码来源:tests.py


示例17: test_non_public_group_returns_false

 def test_non_public_group_returns_false(self, get_project_list):
     get_project_list.return_value = []
     self.group.is_public = False
     self.user.is_superuser = False
     result = group_is_public(self.group, self.user)
     assert result is False
开发者ID:nagyistoce,项目名称:sentry,代码行数:6,代码来源:tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.plugin_config函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.get_project_list函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap