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


Python permissions.can_admin_group函数代码示例

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


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

示例1: get_view_response

    def get_view_response(self, request, group):
        from sentry.models import Event
        from sentry.permissions import can_admin_group

        self.selected = request.path == self.get_url(group)

        if not self.selected:
            return

        response = self.view(request, group)

        if not response:
            return

        if isinstance(response, HttpResponseRedirect):
            return response

        if not isinstance(response, Response):
            raise NotImplementedError("Use self.render() when returning responses.")

        event = group.get_latest_event() or Event()
        event.group = group

        return response.respond(
            request,
            {
                "plugin": self,
                "project": group.project,
                "group": group,
                "event": event,
                "can_admin_event": can_admin_group(request.user, group),
            },
        )
开发者ID:beyondtime,项目名称:sentry,代码行数:33,代码来源:base.py

示例2: get_view_response

    def get_view_response(self, request, group):
        from sentry.permissions import can_admin_group

        self.selected = request.path == self.get_url(group)

        if not self.selected:
            return

        response = self.view(request, group)

        if not response:
            return

        if isinstance(response, HttpResponseRedirect):
            return response

        if not isinstance(response, Response):
            raise NotImplementedError('Please use self.render() when returning responses.')

        return response.respond(request, {
            'plugin': self,
            'project': group.project,
            'group': group,
            'can_admin_event': can_admin_group(request.user, group),
        })
开发者ID:abossard,项目名称:sentry,代码行数:25,代码来源:base.py

示例3: group_event_details

def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, id=event_id)

    base_qs = group.event_set.exclude(id=event_id)
    try:
        next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
    except Event.DoesNotExist:
        next_event = None

    try:
        prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
    except Event.DoesNotExist:
        prev_event = None

    return render_to_response('sentry/groups/event.html', {
        'project': project,
        'page': 'event',
        'group': group,
        'event': event,
        'next_event': next_event,
        'prev_event': prev_event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
开发者ID:MSylvia,项目名称:sentry,代码行数:25,代码来源:groups.py

示例4: group_event_list

def group_event_list(request, project, group):
    event_list = group.event_set.all().order_by('-datetime')

    return render_to_response('sentry/groups/event_list.html', {
        'project': project,
        'group': group,
        'event_list': event_list,
        'page': 'event_list',
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
开发者ID:acdha,项目名称:sentry,代码行数:10,代码来源:groups.py

示例5: group_tag_details

def group_tag_details(request, project, group, tag_name):
    return render_to_response('sentry/plugins/bases/tag/index.html', {
        'project': project,
        'group': group,
        'title': tag_name.replace('_', ' ').title(),
        'tag_name': tag_name,
        'unique_tags': group.get_unique_tags(tag_name),
        'group': group,
        'page': 'tag_details',
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
开发者ID:acdha,项目名称:sentry,代码行数:11,代码来源:groups.py

示例6: group_event_details

def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, pk=event_id)

    return render_to_response('sentry/groups/event.html', {
        'project': project,
        'page': 'event',
        'group': group,
        'event': event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
开发者ID:allanlei,项目名称:sentry,代码行数:12,代码来源:groups.py

示例7: render_with_group_context

def render_with_group_context(group, template, context, request=None,
                              event=None, is_public=False):
    context.update({
        'team': group.project.team,
        'organization': group.project.organization,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            # TODO(dcramer): we dont want to actually use gt/lt here as it should
            # be inclusive. However, that would need to ensure we have some kind
            # of way to know which event was the previous (an offset), or to add
            # a third sort key (which is not yet indexed)
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(
                    datetime__gt=event.datetime,
                ).order_by('datetime','id')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(
                    datetime__lt=event.datetime,
                ).order_by('-datetime','-id')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
开发者ID:uber,项目名称:sentry,代码行数:53,代码来源:groups.py

示例8: group_event_list

def group_event_list(request, project, group):
    event_list = group.event_set.all().order_by("-datetime")

    return render_to_response(
        "sentry/groups/event_list.html",
        {
            "project": project,
            "group": group,
            "event_list": event_list,
            "page": "event_list",
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
开发者ID:davidszotten,项目名称:sentry,代码行数:14,代码来源:groups.py

示例9: group

def group(request, 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(group=group)

    return render_to_response('sentry/groups/details.html', {
        'project': project,
        'page': 'details',
        'group': group,
        'event': event,
        'interface_list': _get_rendered_interfaces(event),
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    }, request)
开发者ID:acdha,项目名称:sentry,代码行数:15,代码来源:groups.py

示例10: group_tag_details

def group_tag_details(request, project, group, tag_name):
    return render_to_response(
        "sentry/plugins/bases/tag/index.html",
        {
            "project": project,
            "group": group,
            "title": tag_name.replace("_", " ").title(),
            "tag_name": tag_name,
            "unique_tags": group.get_unique_tags(tag_name),
            "group": group,
            "page": "tag_details",
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
开发者ID:davidszotten,项目名称:sentry,代码行数:15,代码来源:groups.py

示例11: render_with_group_context

def render_with_group_context(group, template, context, request=None):
    # 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.update({
        'project': group.project,
        'group': group,
        'event': event,
        'json_data': event.data.get('extra', {}),
        'version_data': event.data.get('modules', None),
        'can_admin_event': can_admin_group(request.user, group),
    })

    return render_to_response(template, context, request)
开发者ID:MSylvia,项目名称:sentry,代码行数:16,代码来源:groups.py

示例12: group_event_details

def group_event_details(request, project, group, event_id):
    event = get_object_or_404(group.event_set, pk=event_id)

    return render_to_response(
        "sentry/groups/event.html",
        {
            "project": project,
            "page": "event_list",
            "group": group,
            "event": event,
            "interface_list": _get_rendered_interfaces(event),
            "json_data": event.data.get("extra", {}),
            "version_data": event.data.get("modules", None),
            "can_admin_event": can_admin_group(request.user, group),
        },
        request,
    )
开发者ID:davidszotten,项目名称:sentry,代码行数:17,代码来源:groups.py

示例13: render_with_group_context

def render_with_group_context(group, template, context, request=None,
                              event=None, is_public=False):
    context.update({
        'team': group.project.team,
        'organization': group.project.organization,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'can_remove_event': can_remove_group(request.user, group),
    })

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get('extra', {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({
                'tags': event.get_tags(),
                'json_data': extra_data,
            })

        context.update({
            'event': event,
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
开发者ID:galdwulf,项目名称:sentry,代码行数:45,代码来源:groups.py

示例14: render_with_group_context

def render_with_group_context(group, template, context, request=None, event=None, is_public=False):
    context.update(
        {
            "team": group.project.team,
            "project": group.project,
            "group": group,
            "can_admin_event": can_admin_group(request.user, group),
        }
    )

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by("datetime")[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by("-datetime")[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        if not is_public:
            extra_data = event.data.get("extra", {})
            if not isinstance(extra_data, dict):
                extra_data = {}

            context.update({"tags": event.get_tags(), "json_data": extra_data})

        context.update(
            {
                "event": event,
                "version_data": event.data.get("modules", None),
                "next_event": next_event,
                "prev_event": prev_event,
            }
        )

    return render_to_response(template, context, request)
开发者ID:Getsidecar,项目名称:sentry,代码行数:43,代码来源:groups.py

示例15: render_with_group_context

def render_with_group_context(group, template, context, request=None, event=None):
    activity = Activity.objects.filter(
        group=group,
    ).order_by('-datetime').select_related('user')
    if event:
        activity = activity.filter(Q(event__isnull=True) | Q(event=event))

    activity = list(activity)

    context.update({
        'team': group.project.team,
        'project': group.project,
        'group': group,
        'can_admin_event': can_admin_group(request.user, group),
        'SECTION': 'events',
        'activity': activity,
    })

    if event:
        if event.id:
            base_qs = group.event_set.exclude(id=event.id)
            try:
                next_event = base_qs.filter(datetime__gte=event.datetime).order_by('datetime')[0:1].get()
            except Event.DoesNotExist:
                next_event = None

            try:
                prev_event = base_qs.filter(datetime__lte=event.datetime).order_by('-datetime')[0:1].get()
            except Event.DoesNotExist:
                prev_event = None
        else:
            next_event = None
            prev_event = None

        context.update({
            'event': event,
            'json_data': event.data.get('extra', {}),
            'version_data': event.data.get('modules', None),
            'next_event': next_event,
            'prev_event': prev_event,
        })

    return render_to_response(template, context, request)
开发者ID:surflightroy,项目名称:sentry,代码行数:43,代码来源:groups.py


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