本文整理汇总了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),
},
)
示例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),
})
示例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)
示例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)
示例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)
示例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)
示例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)
示例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,
)
示例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)
示例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,
)
示例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)
示例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,
)
示例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)
示例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)
示例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)