本文整理汇总了Python中sentry.permissions.can_remove_project函数的典型用法代码示例。如果您正苦于以下问题:Python can_remove_project函数的具体用法?Python can_remove_project怎么用?Python can_remove_project使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_remove_project函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_project
def remove_project(request, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse("sentry"))
project_list = filter(lambda x: x != project, get_project_list(request.user).itervalues())
form = RemoveProjectForm(request.user, project_list, request.POST or None)
if form.is_valid():
removal_type = form.cleaned_data["removal_type"]
if removal_type == "1":
project.delete()
elif removal_type == "2":
new_project = form.cleaned_data["project"]
project.merge_to(new_project)
elif removal_type == "3":
project.update(status=1)
else:
raise ValueError(removal_type)
return HttpResponseRedirect(reverse("sentry-project-list"))
context = csrf(request)
context.update({"form": form, "project": project})
return render_to_response("sentry/projects/remove.html", context, request)
开发者ID:nkabir,项目名称:sentry,代码行数:26,代码来源:projects.py
示例2: post
def post(self, request, organization, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
form = self.get_form(request)
if form.is_valid():
if project.status != STATUS_HIDDEN:
project.update(status=STATUS_HIDDEN)
delete_project.delay(object_id=project.id)
AuditLogEntry.objects.create(
organization=organization,
actor=request.user,
ip_address=request.META['REMOTE_ADDR'],
target_object=project.id,
event=AuditLogEntryEvent.PROJECT_REMOVE,
data=project.get_audit_log_data(),
)
messages.add_message(
request, messages.SUCCESS,
_('Deletion has been queued and will happen automatically.'))
return HttpResponseRedirect(reverse('sentry-organization-home', args=[team.organization.id]))
context = {
'form': form,
}
return self.respond('sentry/projects/remove.html', context)
开发者ID:hyongbai,项目名称:sentry,代码行数:31,代码来源:remove_project.py
示例3: manage_project
def manage_project(request, project):
result = plugins.first('has_perm', request.user, 'edit_project', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
team_list = get_team_list(request.user)
form = EditProjectForm(request, team_list, request.POST or None, instance=project)
if form.is_valid():
project = form.save()
return HttpResponseRedirect(request.path + '?success=1')
member_list = [(tm, tm.user) for tm in project.team.member_set.select_related('user')]
try:
key = ProjectKey.objects.get(user=request.user, project=project)
except ProjectKey.DoesNotExist:
key = None # superuser
context = csrf(request)
context.update({
'can_remove_project': can_remove_project(request.user, project),
'page': 'details',
'key': key,
'form': form,
'project': project,
'member_list': member_list,
'TEAM_LIST': team_list.values(),
})
return render_to_response('sentry/projects/manage.html', context, request)
开发者ID:lardissone,项目名称:sentry,代码行数:33,代码来源:projects.py
示例4: post
def post(self, request, organization, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
form = self.get_form(request)
if form.is_valid():
if project.status == ProjectStatus.VISIBLE:
project.update(status=ProjectStatus.PENDING_DELETION)
delete_project.delay(object_id=project.id)
AuditLogEntry.objects.create(
organization=organization,
actor=request.user,
ip_address=request.META['REMOTE_ADDR'],
target_object=project.id,
event=AuditLogEntryEvent.PROJECT_REMOVE,
data=project.get_audit_log_data(),
)
messages.add_message(
request, messages.SUCCESS,
_(u'The project %r was scheduled for deletion.') % (project.name.encode('utf-8'),))
return HttpResponseRedirect(reverse('sentry-organization-home', args=[team.organization.id]))
context = {
'form': form,
}
return self.respond('sentry/projects/remove.html', context)
开发者ID:BlueMoebius,项目名称:sentry,代码行数:31,代码来源:remove_project.py
示例5: remove_project
def remove_project(request, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse("sentry"))
project_list = filter(lambda x: x != project, Project.objects.get_for_user(request.user))
form = RemoveProjectForm(request.user, project_list, request.POST or None)
if form.is_valid():
removal_type = form.cleaned_data["removal_type"]
if removal_type == "1":
project.delete()
elif removal_type == "2":
new_project = form.cleaned_data["project"]
project.merge_to(new_project)
elif removal_type == "3":
project.update(status=1)
else:
raise ValueError(removal_type)
return HttpResponseRedirect(reverse("sentry-manage-team-projects", args=[project.team.slug]))
context = csrf(request)
context.update({"team": team, "form": form, "project": project, "SECTION": "team", "SUBSECTION": "projects"})
return render_to_response("sentry/projects/remove.html", context, request)
开发者ID:sennoy,项目名称:sentry,代码行数:26,代码来源:projects.py
示例6: remove_project
def remove_project(request, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
form = RemoveProjectForm(request.user, request.POST or None)
if form.is_valid():
if project.status != STATUS_HIDDEN:
project.update(status=STATUS_HIDDEN)
delete_project.delay(object_id=project.id)
messages.add_message(
request, messages.SUCCESS,
_('Deletion has been queued and will happen automatically.'))
return HttpResponseRedirect(reverse('sentry-manage-team-projects', args=[project.team.slug]))
context = csrf(request)
context.update({
'team': team,
'form': form,
'project': project,
})
return render_to_response('sentry/projects/remove.html', context, request)
开发者ID:aai,项目名称:sentry,代码行数:25,代码来源:remove.py
示例7: manage_project
def manage_project(request, project):
result = plugins.first('has_perm', request.user, 'edit_project', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
# XXX: We probably shouldnt allow changing the team unless they're the project owner
team_list = Team.objects.get_for_user(project.owner or request.user, MEMBER_OWNER)
if request.user.has_perm('sentry.can_change_project'):
form_cls = EditProjectAdminForm
else:
form_cls = EditProjectForm
form = form_cls(request, team_list, request.POST or None, instance=project, initial={
'origins': '\n'.join(get_option('sentry:origins', project) or []),
'owner': project.owner,
})
if form.is_valid():
project = form.save()
set_option('sentry:origins', form.cleaned_data.get('origins') or [], project)
return HttpResponseRedirect(request.path + '?success=1')
context = csrf(request)
context.update({
'can_remove_project': can_remove_project(request.user, project),
'page': 'details',
'form': form,
'project': project,
'TEAM_LIST': team_list.values(),
'SECTION': 'settings',
})
return render_to_response('sentry/projects/manage.html', context, request)
开发者ID:cheekybastard,项目名称:sentry,代码行数:34,代码来源:projects.py
示例8: remove_project
def remove_project(request, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
project_list = filter(lambda x: x != project, Project.objects.get_for_user(request.user))
form = RemoveProjectForm(request.user, project_list, request.POST or None)
if form.is_valid():
removal_type = form.cleaned_data['removal_type']
if removal_type == '1':
project.delete()
elif removal_type == '2':
new_project = form.cleaned_data['project']
project.merge_to(new_project)
elif removal_type == '3':
project.update(status=1)
else:
raise ValueError(removal_type)
return HttpResponseRedirect(reverse('sentry-manage-team-projects', args=[project.team.slug]))
context = csrf(request)
context.update({
'team': team,
'form': form,
'project': project,
'SECTION': 'team',
'SUBSECTION': 'projects'
})
return render_to_response('sentry/projects/remove.html', context, request)
开发者ID:Caramel,项目名称:sentry,代码行数:32,代码来源:projects.py
示例9: manage_project
def manage_project(request, team, project):
result = plugins.first('has_perm', request.user, 'edit_project', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
team_list = Team.objects.get_for_user(project.owner or request.user, MEMBER_OWNER)
form = EditProjectForm(request, team_list, request.POST or None, instance=project, initial={
'origins': '\n'.join(project.get_option('sentry:origins', None) or []),
'owner': project.owner,
'resolve_age': int(project.get_option('sentry:resolve_age', 0)),
})
if form.is_valid():
project = form.save()
project.update_option('sentry:origins', form.cleaned_data.get('origins') or [])
project.update_option('sentry:resolve_age', form.cleaned_data.get('resolve_age'))
messages.add_message(
request, messages.SUCCESS,
_('Changes to your project were saved.'))
return HttpResponseRedirect(reverse('sentry-manage-project', args=[team.slug, project.slug]))
context = csrf(request)
context.update({
'team': team,
'can_remove_project': can_remove_project(request.user, project),
'page': 'details',
'form': form,
'project': project,
'SECTION': 'team',
'SUBSECTION': 'projects'
})
return render_to_response('sentry/projects/manage.html', context, request)
开发者ID:Caramel,项目名称:sentry,代码行数:35,代码来源:projects.py
示例10: remove_project
def remove_project(request, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
project_list = filter(lambda x: x != project, get_project_list(request.user).itervalues())
form = RemoveProjectForm(request.user, project_list, request.POST or None)
if form.is_valid():
removal_type = form.cleaned_data['removal_type']
if removal_type == '1':
project.delete()
elif removal_type == '2':
new_project = form.cleaned_data['project']
project.merge_to(new_project)
elif removal_type == '3':
project.update(status=1)
else:
raise ValueError(removal_type)
return HttpResponseRedirect(reverse('sentry-project-list'))
context = csrf(request)
context.update({
'form': form,
'project': project,
})
return render_to_response('sentry/projects/remove.html', context, request)
开发者ID:Fashiolista,项目名称:sentry,代码行数:29,代码来源:projects.py
示例11: get
def get(self, request, organization, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
form = self.get_form(request)
context = {
'form': form,
}
return self.respond('sentry/projects/remove.html', context)
开发者ID:BlueMoebius,项目名称:sentry,代码行数:11,代码来源:remove_project.py
示例12: manage_project
def manage_project(request, team, project):
result = plugins.first("has_perm", request.user, "edit_project", project)
if result is False and not request.user.has_perm("sentry.can_change_project"):
return HttpResponseRedirect(reverse("sentry"))
# XXX: We probably shouldn't allow changing the team unless they're the project owner
team_list = Team.objects.get_for_user(project.owner or request.user, MEMBER_OWNER)
can_admin_project = request.user == project.owner or request.user.has_perm("sentry.can_change_project")
if can_admin_project:
form_cls = EditProjectAdminForm
else:
form_cls = EditProjectForm
form = form_cls(
request,
team_list,
request.POST or None,
instance=project,
initial={
"origins": "\n".join(project.get_option("sentry:origins", None) or []),
"owner": project.owner,
"resolve_age": int(project.get_option("sentry:resolve_age", 0)),
},
)
if form.is_valid():
project = form.save()
project.update_option("sentry:origins", form.cleaned_data.get("origins") or [])
project.update_option("sentry:resolve_age", form.cleaned_data.get("resolve_age"))
messages.add_message(request, messages.SUCCESS, _("Changes to your project were saved."))
return HttpResponseRedirect(reverse("sentry-manage-project", args=[team.slug, project.slug]))
context = csrf(request)
context.update(
{
"team": team,
"can_remove_project": can_remove_project(request.user, project),
"page": "details",
"form": form,
"project": project,
"SECTION": "team",
"SUBSECTION": "projects",
}
)
return render_to_response("sentry/projects/manage.html", context, request)
开发者ID:sennoy,项目名称:sentry,代码行数:49,代码来源:projects.py
示例13: client_help
def client_help(request, project):
try:
key = ProjectKey.objects.get(user=request.user, project=project)
except ProjectKey.DoesNotExist:
key = None # superuser
context = {
"can_remove_project": can_remove_project(request.user, project),
"page": "client_help",
"project": project,
"key": key,
}
if key:
context.update({"dsn": key.get_dsn(), "dsn_public": key.get_dsn(public=True)})
return render_to_response("sentry/projects/client_help.html", context, request)
开发者ID:nkabir,项目名称:sentry,代码行数:15,代码来源:projects.py
示例14: client_help
def client_help(request, project):
try:
key = ProjectKey.objects.get(user=request.user, project=project)
except ProjectKey.DoesNotExist:
key = None # superuser
context = {
'can_remove_project': can_remove_project(request.user, project),
'page': 'client_help',
'project': project,
'key': key,
}
if key:
context.update({
'dsn': key.get_dsn(),
'dsn_public': key.get_dsn(public=True),
})
return render_to_response('sentry/projects/client_help.html', context, request)
开发者ID:Fashiolista,项目名称:sentry,代码行数:18,代码来源:projects.py
示例15: manage_project
def manage_project(request, project):
result = plugins.first("has_perm", request.user, "edit_project", project)
if result is False and not request.user.has_perm("sentry.can_change_project"):
return HttpResponseRedirect(reverse("sentry"))
team_list = Team.objects.get_for_user(request.user, MEMBER_OWNER)
if request.user.has_perm("sentry.can_change_project"):
form_cls = EditProjectAdminForm
else:
form_cls = EditProjectForm
form = form_cls(
request,
team_list,
request.POST or None,
instance=project,
initial={"origins": "\n".join(get_option("sentry:origins", project) or []), "owner": project.owner},
)
if form.is_valid():
project = form.save()
set_option("sentry:origins", form.cleaned_data.get("origins") or [], project)
return HttpResponseRedirect(request.path + "?success=1")
if not project.team:
member_list = []
else:
member_list = [(tm, tm.user) for tm in project.team.member_set.select_related("user")]
context = csrf(request)
context.update(
{
"can_remove_project": can_remove_project(request.user, project),
"page": "details",
"form": form,
"project": project,
"member_list": member_list,
"TEAM_LIST": team_list.values(),
}
)
return render_to_response("sentry/projects/manage.html", context, request)
开发者ID:nkabir,项目名称:sentry,代码行数:43,代码来源:projects.py
示例16: manage_project
def manage_project(request, team, project):
result = plugins.first('has_perm', request.user, 'edit_project', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
# XXX: We probably shouldnt allow changing the team unless they're the project owner
team_list = Team.objects.get_for_user(project.owner or request.user, MEMBER_OWNER)
can_admin_project = request.user == project.owner or request.user.has_perm('sentry.can_change_project')
if can_admin_project:
form_cls = EditProjectAdminForm
else:
form_cls = EditProjectForm
form = form_cls(request, team_list, request.POST or None, instance=project, initial={
'origins': '\n'.join(get_option('sentry:origins', project) or []),
'owner': project.owner,
})
if form.is_valid():
project = form.save()
set_option('sentry:origins', form.cleaned_data.get('origins') or [], project)
messages.add_message(request, messages.SUCCESS,
_('Changes to your project were saved.'))
return HttpResponseRedirect(reverse('sentry-manage-project', args=[team.slug, project.slug]))
context = csrf(request)
context.update({
'team': team,
'can_remove_project': can_remove_project(request.user, project),
'page': 'details',
'form': form,
'project': project,
'SECTION': 'team',
'SUBSECTION': 'projects'
})
return render_to_response('sentry/projects/manage.html', context, request)
开发者ID:TracyWebTech,项目名称:sentry,代码行数:41,代码来源:projects.py
示例17: post
def post(self, request, organization, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
form = self.get_form(request)
if form.is_valid():
client.delete('/projects/{}/{}/'.format(organization.slug, project.slug),
request.user, is_sudo=True)
messages.add_message(
request, messages.SUCCESS,
_(u'The project %r was scheduled for deletion.') % (project.name.encode('utf-8'),))
return HttpResponseRedirect(reverse('sentry-organization-home', args=[team.organization.slug]))
context = {
'form': form,
}
return self.respond('sentry/projects/remove.html', context)
开发者ID:carriercomm,项目名称:sentry-1,代码行数:21,代码来源:remove_project.py
示例18: manage_project
def manage_project(request, project):
result = plugins.first('has_perm', request.user, 'edit_project', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
team_list = Team.objects.get_for_user(request.user, MEMBER_OWNER)
if request.user.has_perm('sentry.can_change_project'):
form_cls = EditProjectAdminForm
else:
form_cls = EditProjectForm
form = form_cls(request, team_list, request.POST or None, instance=project, initial={
'origins': '\n'.join(get_option('sentry:origins', project) or []),
'owner': project.owner,
})
if form.is_valid():
project = form.save()
set_option('sentry:origins', form.cleaned_data.get('origins') or [], project)
return HttpResponseRedirect(request.path + '?success=1')
if not project.team:
member_list = []
else:
member_list = [(tm, tm.user) for tm in project.team.member_set.select_related('user')]
context = csrf(request)
context.update({
'can_remove_project': can_remove_project(request.user, project),
'page': 'details',
'form': form,
'project': project,
'member_list': member_list,
'TEAM_LIST': team_list.values(),
})
return render_to_response('sentry/projects/manage.html', context, request)
开发者ID:Fashiolista,项目名称:sentry,代码行数:38,代码来源:projects.py
示例19: remove_project
def remove_project(request, team, project):
if not can_remove_project(request.user, project):
return HttpResponseRedirect(reverse('sentry'))
project_list = filter(lambda x: x != project, Project.objects.get_for_user(request.user))
form = RemoveProjectForm(request.user, project_list, request.POST or None)
if form.is_valid():
removal_type = form.cleaned_data['removal_type']
if removal_type == '1':
from sentry.tasks.deletion import delete_project
delete_project.delay(object_id=project.id)
project.update(status=STATUS_HIDDEN)
messages.add_message(
request, messages.SUCCESS,
_('Deletion has been queued and should occur shortly.'))
elif removal_type == '2':
new_project = form.cleaned_data['project']
project.merge_to(new_project)
elif removal_type == '3':
project.update(status=STATUS_HIDDEN)
else:
raise ValueError(removal_type)
return HttpResponseRedirect(reverse('sentry-manage-team-projects', args=[project.team.slug]))
context = csrf(request)
context.update({
'team': team,
'form': form,
'project': project,
})
return render_to_response('sentry/projects/remove.html', context, request)
开发者ID:Hosting-Scripts,项目名称:sentry,代码行数:37,代码来源:remove.py
示例20: get_default_context
def get_default_context(self, request, **kwargs):
context = super(ProjectSettingsView, self).get_default_context(request, **kwargs)
context.update({
'can_remove_project': can_remove_project(request.user, kwargs['project']),
})
return context
开发者ID:brettlangdon,项目名称:sentry,代码行数:6,代码来源:project_settings.py
注:本文中的sentry.permissions.can_remove_project函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论