本文整理汇总了Python中sentry.plugins.plugins.for_project函数的典型用法代码示例。如果您正苦于以下问题:Python for_project函数的具体用法?Python for_project怎么用?Python for_project使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了for_project函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: get_attrs
def get_attrs(self, item_list, user):
from sentry.plugins import plugins
GroupMeta.objects.populate_cache(item_list)
attach_foreignkey(item_list, Group.project, ['team'])
if user.is_authenticated() and item_list:
bookmarks = set(GroupBookmark.objects.filter(
user=user,
group__in=item_list,
).values_list('group_id', flat=True))
seen_groups = dict(GroupSeen.objects.filter(
user=user,
group__in=item_list,
).values_list('group_id', 'last_seen'))
else:
bookmarks = set()
seen_groups = {}
assignees = dict(
(a.group_id, a.user)
for a in GroupAssignee.objects.filter(
group__in=item_list,
).select_related('user')
)
user_counts = dict(
GroupTagKey.objects.filter(
group__in=item_list,
key='sentry:user',
).values_list('group', 'values_seen')
)
snoozes = dict(
GroupSnooze.objects.filter(
group__in=item_list,
).values_list('group', 'until')
)
result = {}
for item in item_list:
active_date = item.active_at or item.last_seen
annotations = []
for plugin in plugins.for_project(project=item.project, version=1):
safe_execute(plugin.tags, None, item, annotations)
for plugin in plugins.for_project(project=item.project, version=2):
annotations.extend(safe_execute(plugin.get_annotations, group=item) or ())
result[item] = {
'assigned_to': serialize(assignees.get(item.id)),
'is_bookmarked': item.id in bookmarks,
'has_seen': seen_groups.get(item.id, active_date) > active_date,
'annotations': annotations,
'user_count': user_counts.get(item.id, 0),
'snooze': snoozes.get(item.id),
}
return result
开发者ID:jonashaag,项目名称:sentry,代码行数:59,代码来源:group.py
示例3: 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
示例4: get_attrs
def get_attrs(self, item_list, user):
from sentry.plugins import plugins
GroupMeta.objects.populate_cache(item_list)
attach_foreignkey(item_list, Group.project, ["team"])
if user.is_authenticated() and item_list:
bookmarks = set(
GroupBookmark.objects.filter(user=user, group__in=item_list).values_list("group_id", flat=True)
)
seen_groups = dict(
GroupSeen.objects.filter(user=user, group__in=item_list).values_list("group_id", "last_seen")
)
else:
bookmarks = set()
seen_groups = {}
tag_counts = defaultdict(dict)
tag_results = GroupTagKey.objects.filter(group__in=item_list).values_list("key", "group", "values_seen")
for key, group_id, values_seen in tag_results:
tag_counts[key][group_id] = values_seen
assignees = dict(
(a.group_id, a.user) for a in GroupAssignee.objects.filter(group__in=item_list).select_related("user")
)
result = {}
for item in item_list:
active_date = item.active_at or item.last_seen
tags = {}
for key in tag_counts.iterkeys():
label = TAG_LABELS.get(key, key.replace("_", " ")).lower()
try:
value = tag_counts[key].get(item.id, 0)
except KeyError:
value = 0
tags[key] = {"label": label, "count": value}
annotations = []
for plugin in plugins.for_project(project=item.project, version=1):
safe_execute(plugin.tags, None, item, annotations)
for plugin in plugins.for_project(project=item.project, version=2):
annotations.extend(safe_execute(plugin.get_annotations, item) or ())
result[item] = {
"assigned_to": serialize(assignees.get(item.id)),
"is_bookmarked": item.id in bookmarks,
"has_seen": seen_groups.get(item.id, active_date) > active_date,
"tags": tags,
"annotations": annotations,
}
return result
开发者ID:Qwiz,项目名称:sentry,代码行数:54,代码来源:group.py
示例5: get_plugins
def get_plugins(self):
from sentry.plugins.bases.notify import NotificationPlugin
results = []
for plugin in plugins.for_project(self.project, version=1):
if not isinstance(plugin, NotificationPlugin):
continue
results.append(plugin)
for plugin in plugins.for_project(self.project, version=2):
for notifier in (safe_execute(plugin.get_notifiers, _with_transaction=False) or ()):
results.append(notifier)
return results
开发者ID:Akashguharoy,项目名称:sentry,代码行数:14,代码来源:notify_event_service.py
示例6: get_activity_notifiers
def get_activity_notifiers(project):
from sentry.plugins.bases.notify import NotificationPlugin
from sentry.plugins import plugins
results = []
for plugin in plugins.for_project(project, version=1):
if isinstance(plugin, NotificationPlugin):
results.append(plugin)
for plugin in plugins.for_project(project, version=2):
for notifier in (safe_execute(plugin.get_notifiers, _with_transaction=False) or ()):
results.append(notifier)
return results
开发者ID:Akashguharoy,项目名称:sentry,代码行数:14,代码来源:activity.py
示例7: post_process_group
def post_process_group(event, is_new, is_regression, is_sample, **kwargs):
"""
Fires post processing hooks for a group.
"""
from sentry.models import Project
from sentry.rules.processor import RuleProcessor
project = Project.objects.get_from_cache(id=event.group.project_id)
if settings.SENTRY_ENABLE_EXPLORE_CODE:
record_affected_code.delay(event=event)
if settings.SENTRY_ENABLE_EXPLORE_USERS:
record_affected_user.delay(event=event)
for plugin in plugins.for_project(project):
plugin_post_process_group.apply_async(
kwargs={
'plugin_slug': plugin.slug,
'event': event,
'is_new': is_new,
'is_regresion': is_regression,
'is_sample': is_sample,
},
expires=300,
)
rp = RuleProcessor(event, is_new, is_regression, is_sample)
# TODO(dcramer): ideally this would fanout, but serializing giant
# objects back and forth isn't super efficient
for callback, futures in rp.apply():
safe_execute(callback, event, futures)
开发者ID:arsh-co,项目名称:sentry,代码行数:32,代码来源:post_process.py
示例8: test_doesnt_disable_plugin_when_partially_migrated
def test_doesnt_disable_plugin_when_partially_migrated(self):
self.setupPluginTest()
# Repo accessible by new Integration
Repository.objects.create(
organization_id=self.organization.id,
name=self.project_a['name'],
url=u'https://{}.visualstudio.com/_git/{}'.format(
self.vsts_account_name,
self.repo_name,
),
provider='visualstudio',
external_id=self.repo_id,
)
# Inaccessible Repo - causes plugin to stay enabled
Repository.objects.create(
organization_id=self.organization.id,
name='NotReachable',
url='https://randoaccount.visualstudio.com/Product/_git/NotReachable',
provider='visualstudio',
external_id='123456789',
)
self.assert_installation()
# Still enabled
assert 'vsts' in [p.slug for p in plugins.for_project(self.project)]
开发者ID:yaoqi,项目名称:sentry,代码行数:28,代码来源:test_integration.py
示例9: plugin_is_regression
def plugin_is_regression(group, event):
project = event.project
for plugin in plugins.for_project(project):
result = safe_execute(plugin.is_regression, group, event, version=1, _with_transaction=False)
if result is not None:
return result
return True
开发者ID:yoachum,项目名称:sentry,代码行数:7,代码来源:event_manager.py
示例10: plugin_is_regression
def plugin_is_regression(group, event):
project = event.project
for plugin in plugins.for_project(project):
result = safe_execute(plugin.is_regression, group, event)
if result is not None:
return result
return True
开发者ID:PostPCEra,项目名称:sentry,代码行数:7,代码来源:event_manager.py
示例11: post_process_group
def post_process_group(event, is_new, is_regression, is_sample, **kwargs):
"""
Fires post processing hooks for a group.
"""
from sentry.models import Project
from sentry.rules.processor import RuleProcessor
project_id = event.group.project_id
Raven.tags_context({
'project': project_id,
})
project = Project.objects.get_from_cache(id=project_id)
_capture_stats(event, is_new)
rp = RuleProcessor(event, is_new, is_regression, is_sample)
# TODO(dcramer): ideally this would fanout, but serializing giant
# objects back and forth isn't super efficient
for callback, futures in rp.apply():
safe_execute(callback, event, futures)
for plugin in plugins.for_project(project):
plugin_post_process_group(
plugin_slug=plugin.slug,
event=event,
is_new=is_new,
is_regresion=is_regression,
is_sample=is_sample,
)
开发者ID:haojiang1,项目名称:sentry,代码行数:30,代码来源:post_process.py
示例12: post_process_group
def post_process_group(event, is_new, is_regression, is_sample, **kwargs):
"""
Fires post processing hooks for a group.
"""
from sentry.models import Project
from sentry.rules.processor import RuleProcessor
project = Project.objects.get_from_cache(id=event.group.project_id)
_capture_stats(event, is_new)
if settings.SENTRY_ENABLE_EXPLORE_CODE:
record_affected_code.delay(event=event)
record_affected_user.delay(event=event)
record_additional_tags(event=event)
rp = RuleProcessor(event, is_new, is_regression, is_sample)
# TODO(dcramer): ideally this would fanout, but serializing giant
# objects back and forth isn't super efficient
for callback, futures in rp.apply():
safe_execute(callback, event, futures)
for plugin in plugins.for_project(project):
plugin_post_process_group(
plugin_slug=plugin.slug,
event=event,
is_new=is_new,
is_regresion=is_regression,
is_sample=is_sample,
)
开发者ID:kevinlondon,项目名称:sentry,代码行数:32,代码来源:post_process.py
示例13: test_disable_plugin_when_fully_migrated
def test_disable_plugin_when_fully_migrated(self):
project = Project.objects.create(
organization_id=self.organization.id,
)
plugin = plugins.get('bitbucket')
plugin.enable(project)
# Accessible to new Integration
Repository.objects.create(
organization_id=self.organization.id,
name='sentryuser/repo',
url='https://bitbucket.org/sentryuser/repo',
provider='bitbucket',
external_id='123456',
config={'name': 'sentryuser/repo'},
)
self.client.post(
self.path,
data=self.data_from_bitbucket,
)
integration = Integration.objects.get(
provider=self.provider,
external_id=self.client_key,
)
responses.add(
responses.GET,
u'https://api.bitbucket.org/2.0/repositories/sentryuser/repo/hooks',
json={
'values': [{
'description': 'sentry-bitbucket-repo-hook',
}],
},
)
assert 'bitbucket' in [p.slug for p in plugins.for_project(project)]
with self.tasks():
BitbucketIntegrationProvider().post_install(
integration,
self.organization,
)
assert 'bitbucket' not in [p.slug for p in plugins.for_project(project)]
开发者ID:Kayle009,项目名称:sentry,代码行数:47,代码来源:test_installed.py
示例14: get_widgets
def get_widgets(group, request):
project = group.project
for plugin in plugins.for_project(project):
resp = safe_execute(plugin.widget, request, group)
if resp:
yield resp.render(request)
开发者ID:280185386,项目名称:sentry,代码行数:8,代码来源:sentry_plugins.py
示例15: get_actions
def get_actions(group, request):
project = group.project
action_list = []
for plugin in plugins.for_project(project, version=1):
results = safe_execute(plugin.actions, request, group, action_list)
if not results:
continue
action_list = results
for plugin in plugins.for_project(project, version=2):
for action in (safe_execute(plugin.get_actions, request, group) or ()):
action_list.append(action)
return [(a[0], a[1], request.path == a[1]) for a in action_list]
开发者ID:280185386,项目名称:sentry,代码行数:17,代码来源:sentry_plugins.py
示例16: _get_actions
def _get_actions(self, request, group):
project = group.project
action_list = []
for plugin in plugins.for_project(project, version=1):
results = safe_execute(plugin.actions, request, group, action_list)
if not results:
continue
action_list = results
for plugin in plugins.for_project(project, version=2):
for action in (safe_execute(plugin.get_actions, request, group) or ()):
action_list.append(action)
return action_list
开发者ID:CBEPX,项目名称:sentry,代码行数:17,代码来源:group_details.py
示例17: record_additional_tags
def record_additional_tags(event):
from sentry.models import Group
added_tags = []
for plugin in plugins.for_project(event.project, version=2):
added_tags.extend(safe_execute(plugin.get_tags, event) or ())
if added_tags:
Group.objects.add_tags(event.group, added_tags)
开发者ID:haojiang1,项目名称:sentry,代码行数:8,代码来源:post_process.py
示例18: _get_context_plugins
def _get_context_plugins(self, request, group):
project = group.project
return serialize([
plugin
for plugin in plugins.for_project(project, version=None)
if plugin.has_project_conf() and hasattr(plugin, 'get_custom_contexts')
and plugin.get_custom_contexts()
], request.user, PluginSerializer(project))
开发者ID:duanshuaimin,项目名称:sentry,代码行数:8,代码来源:group_details.py
示例19: get_plugins
def get_plugins(self):
from sentry.plugins.bases.notify import NotificationPlugin
results = []
for plugin in plugins.for_project(self.project):
if not isinstance(plugin, NotificationPlugin):
continue
results.append(plugin)
return results
开发者ID:PostPCEra,项目名称:sentry,代码行数:9,代码来源:notify_event_service.py
示例20: _get_available_issue_plugins
def _get_available_issue_plugins(self, request, group):
project = group.project
plugin_issues = []
for plugin in plugins.for_project(project, version=1):
if isinstance(plugin, IssueTrackingPlugin2):
plugin_issues = safe_execute(plugin.plugin_issues, request, group, plugin_issues,
_with_transaction=False)
return plugin_issues
开发者ID:duanshuaimin,项目名称:sentry,代码行数:9,代码来源:group_details.py
注:本文中的sentry.plugins.plugins.for_project函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论