本文整理汇总了Python中sentry.plugins.plugins.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_simple
def test_simple(self, test_configuration):
project = self.create_project()
self.login_as(user=self.user)
plugins.get('webhooks').disable(project)
url = reverse(
'sentry-api-0-project-plugin-details',
kwargs={
'organization_slug': project.organization.slug,
'project_slug': project.slug,
'plugin_id': 'webhooks',
}
)
response = self.client.post(url)
assert response.status_code == 201, (response.status_code, response.content)
assert ProjectOption.objects.get(
key='webhooks:enabled',
project=project,
).value is True
# Testing the Plugin
response = self.client.post(url, {'test': True})
test_configuration.assert_called_once_with(project)
assert response.status_code == 200, (response.status_code, response.content)
开发者ID:NuttasitBoonwat,项目名称:sentry,代码行数:26,代码来源:test_project_plugin_details.py
示例2: test_simple
def test_simple(self):
project = self.create_project()
self.login_as(user=self.user)
plugins.get('webhooks').enable(project)
url = reverse(
'sentry-api-0-project-plugin-details',
kwargs={
'organization_slug': project.organization.slug,
'project_slug': project.slug,
'plugin_id': 'webhooks',
}
)
audit = AuditLogEntry.objects.filter(target_object=project.id)
assert not audit
response = self.client.delete(url)
audit = AuditLogEntry.objects.get(target_object=project.id)
assert audit.event == 112
assert response.status_code == 204, (response.status_code, response.content)
assert ProjectOption.objects.get(
key='webhooks:enabled',
project=project,
).value is False
开发者ID:Kayle009,项目名称:sentry,代码行数:28,代码来源:test_project_plugin_details.py
示例3: setUp
def setUp(self):
self.projectA = self.create_project()
self.projectB = self.create_project(organization=self.projectA.organization)
plugins.get('webhooks').enable(self.projectA)
plugins.get('mail').enable(self.projectB)
self.login_as(user=self.user)
开发者ID:mjumbewu,项目名称:sentry,代码行数:8,代码来源:test_organization_plugins.py
示例4: configure_project_plugin
def configure_project_plugin(request, organization, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
if not plugin.can_configure_for_project(project):
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
view = plugin.configure(request, project=project)
if isinstance(view, HttpResponse):
return view
context = csrf(request)
context.update({
'organization': organization,
'team': project.team,
'page': 'plugin',
'title': plugin.get_title(),
'view': view,
'project': project,
'plugin': plugin,
'plugin_is_enabled': plugin.is_enabled(project),
})
return render_to_response('sentry/projects/plugins/configure.html',
context, request)
开发者ID:Natim,项目名称:sentry,代码行数:27,代码来源:plugins.py
示例5: test_disable_plugin_when_fully_migrated
def test_disable_plugin_when_fully_migrated(self):
self._stub_github()
project = Project.objects.create(
organization_id=self.organization.id,
)
plugin = plugins.get('github')
plugin.enable(project)
# Accessible to new Integration - mocked in _stub_github
Repository.objects.create(
organization_id=self.organization.id,
name='Test-Organization/foo',
url='https://github.com/Test-Organization/foo',
provider='github',
external_id='123',
config={
'name': 'Test-Organization/foo',
},
)
# Enabled before
assert 'github' in [p.slug for p in plugins.for_project(project)]
with self.tasks():
self.assert_setup_flow()
# Disabled after Integration installed
assert 'github' not in [p.slug for p in plugins.for_project(project)]
开发者ID:Kayle009,项目名称:sentry,代码行数:30,代码来源:test_integration.py
示例6: test_integrated
def test_integrated(self):
event = self.create_event()
action_data = {
'id': 'sentry.rules.actions.notify_event.NotifyEventAction',
}
condition_data = {
'id': 'sentry.rules.conditions.every_event.EveryEventCondition',
}
Rule.objects.filter(project=event.project).delete()
rule = Rule.objects.create(
project=event.project,
data={
'conditions': [condition_data],
'actions': [action_data],
}
)
rp = RuleProcessor(event, is_new=True, is_regression=True, is_sample=False)
results = list(rp.apply())
assert len(results) == 1
callback, futures = results[0]
assert callback == plugins.get('mail').rule_notify
assert len(futures) == 1
assert futures[0].rule == rule
assert futures[0].kwargs == {}
开发者ID:280185386,项目名称:sentry,代码行数:27,代码来源:test_processor.py
示例7: after
def after(self, event, state):
service = self.get_option('service')
extra = {'event_id': event.id}
if not service:
self.logger.info('rules.fail.is_configured', extra=extra)
return
app = None
try:
app = SentryApp.objects.get(slug=service)
except SentryApp.DoesNotExist:
pass
if app:
kwargs = {'sentry_app': app}
metrics.incr('notifications.sent', instance=app.slug, skip_internal=False)
yield self.future(notify_sentry_app, **kwargs)
else:
plugin = plugins.get(service)
if not plugin.is_enabled(self.project):
extra['project_id'] = self.project.id
self.logger.info('rules.fail.is_enabled', extra=extra)
return
group = event.group
if not plugin.should_notify(group=group, event=event):
extra['group_id'] = group.id
self.logger.info('rule.fail.should_notify', extra=extra)
return
metrics.incr('notifications.sent', instance=plugin.slug, skip_internal=False)
yield self.future(plugin.rule_notify)
开发者ID:Kayle009,项目名称:sentry,代码行数:34,代码来源:notify_event_service.py
示例8: configure_project_plugin
def configure_project_plugin(request, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.slug]))
if not plugin.is_enabled(project):
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.slug]))
result = plugins.first('has_perm', request.user, 'configure_project_plugin', project, plugin)
if result is False and not request.user.is_superuser:
return HttpResponseRedirect(reverse('sentry'))
form = plugin.project_conf_form
if form is None:
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.slug]))
action, view = plugin_config(plugin, project, request)
if action == 'redirect':
return HttpResponseRedirect(request.path + '?success=1')
context = csrf(request)
context.update({
'page': 'plugin',
'title': plugin.get_title(),
'view': view,
'project': project,
'plugin': plugin,
})
return render_to_response('sentry/projects/plugins/configure.html', context, request)
开发者ID:Fashiolista,项目名称:sentry,代码行数:31,代码来源:projects.py
示例9: handle
def handle(self, request, organization, team, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return self.redirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
if not plugin.can_configure_for_project(project):
return self.redirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
issue_v2_plugin = None
is_enabled = plugin.is_enabled(project)
if isinstance(plugin, IssueTrackingPlugin2):
view = None
issue_v2_plugin = {
'title': plugin.get_title(),
'slug': plugin.slug,
'can_disable': plugin.can_disable,
'is_enabled': is_enabled
}
else:
view = plugin.configure(request=request, project=project)
if isinstance(view, HttpResponse):
return view
context = {
'page': 'plugin',
'title': plugin.get_title(),
'view': view,
'plugin': plugin,
'plugin_is_enabled': is_enabled,
'issue_v2_plugin': issue_v2_plugin
}
return self.respond('sentry/projects/plugins/configure.html', context)
开发者ID:WhoTrades,项目名称:sentry,代码行数:34,代码来源:project_plugin_configure.py
示例10: _handle_disable_plugin
def _handle_disable_plugin(self, request, project):
plugin = plugins.get(request.POST['plugin'])
plugin.set_option('enabled', False, project)
messages.add_message(
request, messages.SUCCESS,
constants.OK_PLUGIN_DISABLED.format(name=plugin.get_title()),
)
开发者ID:KinKir,项目名称:sentry,代码行数:7,代码来源:project_release_tracking.py
示例11: configure_project_plugin
def configure_project_plugin(request, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return HttpResponseRedirect(reverse("sentry-manage-project", args=[project.slug]))
if not plugin.is_enabled(project):
return HttpResponseRedirect(reverse("sentry-manage-project", args=[project.slug]))
result = plugins.first("has_perm", request.user, "configure_project_plugin", project, plugin)
if result is False and not request.user.is_superuser:
return HttpResponseRedirect(reverse("sentry"))
form = plugin.project_conf_form
if form is None:
return HttpResponseRedirect(reverse("sentry-manage-project", args=[project.slug]))
action, view = plugin_config(plugin, project, request)
if action == "redirect":
return HttpResponseRedirect(request.path + "?success=1")
context = csrf(request)
context.update({"page": "plugin", "title": plugin.get_title(), "view": view, "project": project, "plugin": plugin})
return render_to_response("sentry/projects/plugins/configure.html", context, request)
开发者ID:nkabir,项目名称:sentry,代码行数:25,代码来源:projects.py
示例12: post
def post(self, request, plugin_id, project_id, signature):
project = Project.objects.get_from_cache(id=project_id)
token = ProjectOption.objects.get_value(project, 'sentry:release-token')
logger.info('Incoming webhook for project_id=%s, plugin_id=%s',
project_id, plugin_id)
if not self.verify(plugin_id, project_id, token, signature):
logger.warn('Unable to verify signature for release hook')
return HttpResponse(status=403)
if plugin_id == 'builtin':
return self._handle_builtin(request, project)
plugin = plugins.get(plugin_id)
if not plugin.is_enabled(project):
logger.warn('Disabled release hook received for project_id=%s, plugin_id=%s',
project_id, plugin_id)
return HttpResponse(status=403)
cls = plugin.get_release_hook()
hook = cls(project)
hook.handle(request)
return HttpResponse(status=204)
开发者ID:Akashguharoy,项目名称:sentry,代码行数:26,代码来源:release_webhook.py
示例13: handle
def handle(self, request, organization, team, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return self.redirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
if not plugin.can_configure_for_project(project):
return self.redirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
react_plugin = None
is_enabled = plugin.is_enabled(project)
if isinstance(plugin, IssueTrackingPlugin2) or isinstance(plugin, NotificationPlugin):
view = None
response = client.get('/projects/{}/{}/plugins/{}/'.format(
organization.slug,
project.slug,
slug,
), request=request)
react_plugin = response.data
else:
view = plugin.configure(request=request, project=project)
if isinstance(view, HttpResponse):
return view
context = {
'page': 'plugin',
'title': plugin.get_title(),
'view': view,
'plugin': plugin,
'plugin_is_enabled': is_enabled,
'react_plugin': react_plugin,
}
return self.respond('sentry/projects/plugins/configure.html', context)
开发者ID:ForkRepo,项目名称:sentry,代码行数:34,代码来源:project_plugin_configure.py
示例14: post
def post(self, request, plugin_id, project_id, signature):
project = Project.objects.get_from_cache(id=project_id)
token = ProjectOption.objects.get_value(project, 'sentry:release-token')
logger.info('Incoming webhook for project_id=%s, plugin_id=%s',
project_id, plugin_id)
if not self.verify(plugin_id, project_id, token, signature):
logger.warn('Unable to verify signature for release hook')
return HttpResponse(status=403)
if plugin_id == 'builtin':
return self._handle_builtin(request, project)
plugin = plugins.get(plugin_id)
if not plugin.is_enabled(project):
logger.warn('Disabled release hook received for project_id=%s, plugin_id=%s',
project_id, plugin_id)
return HttpResponse(status=403)
cls = plugin.get_release_hook()
hook = cls(project)
try:
hook.handle(request)
except HookValidationError as exc:
return HttpResponse(
status=400,
content=json.dumps({'error': six.text_type(exc)}),
content_type='application/json',
)
return HttpResponse(status=204)
开发者ID:duanshuaimin,项目名称:sentry,代码行数:33,代码来源:release_webhook.py
示例15: post
def post(self, request, organization, team, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return self.redirect(
reverse(
'sentry-configure-project-plugin',
args=[project.organization.slug, project.slug, slug]
)
)
if not plugin.is_enabled(project):
return self.redirect(
reverse(
'sentry-configure-project-plugin',
args=[project.organization.slug, project.slug, slug]
)
)
plugin.disable(project=project)
return self.redirect(
reverse(
'sentry-configure-project-plugin',
args=[project.organization.slug, project.slug, slug]
)
)
开发者ID:NuttasitBoonwat,项目名称:sentry,代码行数:27,代码来源:project_plugin_disable.py
示例16: configure_project_plugin
def configure_project_plugin(request, organization, project, slug):
try:
plugin = plugins.get(slug)
except KeyError:
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
if not plugin.can_enable_for_projects():
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
form = plugin.project_conf_form
if form is None:
return HttpResponseRedirect(reverse('sentry-manage-project', args=[project.organization.slug, project.slug]))
action, view = plugin_config(plugin, project, request)
if action == 'redirect':
messages.add_message(
request, messages.SUCCESS,
_('Your settings were saved successfully.'))
return HttpResponseRedirect(request.path)
context = csrf(request)
context.update({
'organization': organization,
'team': project.team,
'page': 'plugin',
'title': plugin.get_title(),
'view': view,
'project': project,
'plugin': plugin,
'plugin_is_enabled': plugin.is_enabled(project),
})
return render_to_response('sentry/projects/plugins/configure.html', context, request)
开发者ID:GpadillaQ,项目名称:sentry,代码行数:34,代码来源:plugins.py
示例17: _handle_enable_plugin
def _handle_enable_plugin(self, request, project):
plugin = plugins.get(request.POST['plugin'])
plugin.enable(project)
messages.add_message(
request, messages.SUCCESS,
constants.OK_PLUGIN_ENABLED.format(name=plugin.get_title()),
)
开发者ID:Natim,项目名称:sentry,代码行数:7,代码来源:project_release_tracking.py
示例18: test_get
def test_get(self):
project = self.create_project()
issues = plugins.get('issuetrackingplugin2')
with patch.object(issues, 'is_hidden', return_value=True):
self.login_as(user=self.user)
url = reverse(
'sentry-api-0-project-plugins',
kwargs={
'organization_slug': project.organization.slug,
'project_slug': project.slug,
}
)
response = self.client.get(url)
assert response.status_code == 200, (response.status_code, response.content)
assert len(response.data) >= 9
auto_tag = response.data[0]
assert auto_tag['name'] == 'Auto Tag: Browsers'
assert auto_tag['enabled'] is True
assert auto_tag['isHidden'] is False
self.assert_plugin_shape(auto_tag)
issues = filter(lambda p: p['slug'] == 'issuetrackingplugin2', response.data)[0]
assert issues['name'] == 'IssueTrackingPlugin2'
assert issues['enabled'] is False
assert issues['isHidden'] is True
self.assert_plugin_shape(issues)
开发者ID:Kayle009,项目名称:sentry,代码行数:30,代码来源:test_project_plugins.py
示例19: after
def after(self, event, state):
service = self.get_option('service')
extra = {
'event_id': event.id
}
if not service:
self.logger.info('rules.fail.is_configured', extra=extra)
return
plugin = plugins.get(service)
if not plugin.is_enabled(self.project):
extra['project_id'] = self.project.id
self.logger.info('rules.fail.is_enabled', extra=extra)
return
group = event.group
if not plugin.should_notify(group=group, event=event):
extra['group_id'] = group.id
self.logger.info('rule.fail.should_notify', extra=extra)
return
metrics.incr('notifications.sent', instance=plugin.slug)
yield self.future(plugin.rule_notify)
开发者ID:ForkRepo,项目名称:sentry,代码行数:25,代码来源:notify_event_service.py
示例20: test_disable_for_all_projects
def test_disable_for_all_projects(self):
plugin = plugins.get('example')
plugin.enable(self.project)
assert plugin in plugins.for_project(self.project)
self.migrator.disable_for_all_projects(plugin)
assert plugin not in plugins.for_project(self.project)
开发者ID:Kayle009,项目名称:sentry,代码行数:9,代码来源:test_migrate.py
注:本文中的sentry.plugins.plugins.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论