本文整理汇总了Python中sentry.plugins.plugins.all函数的典型用法代码示例。如果您正苦于以下问题:Python all函数的具体用法?Python all怎么用?Python all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了all函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: preprocess_event
def preprocess_event(cache_key=None, data=None, start_time=None, **kwargs):
from sentry.plugins import plugins
if cache_key:
data = default_cache.get(cache_key)
if data is None:
metrics.incr('events.failed', tags={'reason': 'cache', 'stage': 'pre'})
error_logger.error('preprocess.failed.empty', extra={'cache_key': cache_key})
return
project = data['project']
Raven.tags_context({
'project': project,
})
# Iterate over all plugins looking for processors based on the input data
# plugins should yield a processor function only if it actually can operate
# on the input data, otherwise it should yield nothing
for plugin in plugins.all(version=2):
processors = safe_execute(plugin.get_event_preprocessors, data=data, _with_transaction=False)
for processor in (processors or ()):
# On the first processor found, we just defer to the process_event
# queue to handle the actual work.
process_event.delay(cache_key=cache_key, start_time=start_time)
return
# If we get here, that means the event had no preprocessing needed to be done
# so we can jump directly to save_event
if cache_key:
data = None
save_event.delay(cache_key=cache_key, data=data, start_time=start_time)
开发者ID:mvaled,项目名称:sentry,代码行数:32,代码来源:store.py
示例2: process_event
def process_event(cache_key, start_time=None, **kwargs):
from sentry.plugins import plugins
data = default_cache.get(cache_key)
if data is None:
metrics.incr('events.failed', tags={'reason': 'cache', 'stage': 'process'})
error_logger.error('process.failed.empty', extra={'cache_key': cache_key})
return
project = data['project']
Raven.tags_context({
'project': project,
})
# TODO(dcramer): ideally we would know if data changed by default
has_changed = False
for plugin in plugins.all(version=2):
processors = safe_execute(plugin.get_event_preprocessors, data=data, _with_transaction=False)
for processor in (processors or ()):
result = safe_execute(processor, data)
if result:
data = result
has_changed = True
assert data['project'] == project, 'Project cannot be mutated by preprocessor'
if has_changed:
default_cache.set(cache_key, data, 3600)
save_event.delay(cache_key=cache_key, data=None, start_time=start_time)
开发者ID:mvaled,项目名称:sentry,代码行数:31,代码来源:store.py
示例3: get
def get(self, request, organization):
# Just load all Plugins once.
all_plugins = dict([
(p.slug, p) for p in plugins.all()
])
if 'plugins' in request.GET:
desired_plugins = set(request.GET.getlist('plugins'))
else:
desired_plugins = set(all_plugins.keys())
if not desired_plugins.issubset(set(all_plugins.keys())):
return Response({'detail': 'Invalid plugins'}, status=422)
# Each tuple represents an enabled Plugin (of only the ones we care
# about) and its corresponding Project.
enabled_plugins = ProjectOption.objects.filter(
key__in=['%s:enabled' % slug for slug in desired_plugins],
project__organization=organization,
).select_related('project')
resources = []
for project_option in enabled_plugins:
resources.append(
serialize(
all_plugins[project_option.key.split(':')[0]],
request.user,
OrganizationPluginSerializer(project_option.project),
)
)
return Response(resources)
开发者ID:mjumbewu,项目名称:sentry,代码行数:33,代码来源:organization_plugins.py
示例4: _get_plugin_value
def _get_plugin_value(self, feature, actor):
for plugin in plugins.all(version=2):
for handler in safe_execute(plugin.get_feature_hooks) or ():
rv = handler(feature, actor)
if rv is not None:
return rv
return None
开发者ID:carriercomm,项目名称:sentry-1,代码行数:7,代码来源:manager.py
示例5: notification_settings
def notification_settings(request):
forms = []
for plugin in plugins.all():
for form in safe_execute(plugin.get_notification_forms) or ():
form = safe_execute(form, plugin, request.user, request.POST or None)
if not form:
continue
forms.append(form)
# Ensure our form comes first
forms = [
NotificationSettingsForm(request.user, request.POST or None),
] + forms
if request.POST:
if all(f.is_valid() for f in forms):
for form in forms:
form.save()
messages.add_message(request, messages.SUCCESS, 'Your settings were saved.')
return HttpResponseRedirect(request.path)
context = csrf(request)
context.update({
'forms': forms,
'page': 'notifications',
})
return render_to_response('sentry/account/notifications.html', context, request)
开发者ID:Aaron1011,项目名称:sentry,代码行数:27,代码来源:accounts.py
示例6: preprocess_event
def preprocess_event(cache_key=None, data=None, start_time=None, **kwargs):
from sentry.plugins import plugins
if cache_key:
data = default_cache.get(cache_key)
if data is None:
metrics.incr('events.failed', tags={'reason': 'cache', 'stage': 'pre'})
logger.error('Data not available in preprocess_event (cache_key=%s)', cache_key)
return
project = data['project']
# TODO(dcramer): ideally we would know if data changed by default
has_changed = False
for plugin in plugins.all(version=2):
for processor in (safe_execute(plugin.get_event_preprocessors) or ()):
result = safe_execute(processor, data)
if result:
data = result
has_changed = True
assert data['project'] == project, 'Project cannot be mutated by preprocessor'
if has_changed and cache_key:
default_cache.set(cache_key, data, 3600)
if cache_key:
data = None
save_event.delay(cache_key=cache_key, data=data, start_time=start_time)
开发者ID:noah-lee,项目名称:sentry,代码行数:30,代码来源:store.py
示例7: _iter_plugins
def _iter_plugins(self):
for plugin in plugins.all(version=1):
if not (
isinstance(plugin, IssueTrackingPlugin) or isinstance(plugin, IssueTrackingPlugin2)
):
continue
yield plugin
开发者ID:NuttasitBoonwat,项目名称:sentry,代码行数:7,代码来源:project_issue_tracking.py
示例8: get_filters
def get_filters(model=None, project=None):
filter_list = []
# Add builtins (specified with the FILTERS setting)
for class_path in settings.FILTERS:
if class_path not in FILTER_CACHE:
module_name, class_name = class_path.rsplit('.', 1)
try:
module = __import__(module_name, {}, {}, class_name)
cls = getattr(module, class_name)
except Exception:
logger = logging.getLogger('sentry.errors.filters')
logger.exception('Unable to import %s' % (class_path,))
continue
FILTER_CACHE[class_path] = cls
filter_list.append(FILTER_CACHE[class_path])
# Add plugin-provided filters
for plugin in plugins.all():
if not plugin.is_enabled(project):
continue
for filter_cls in plugin.get_filters(project):
if filter_cls not in filter_list:
filter_list.append(filter_cls)
# yield all filters which support ``model``
for filter_cls in filter_list:
if model and model not in filter_cls.types:
continue
yield filter_cls
开发者ID:SimpleTax,项目名称:sentry,代码行数:31,代码来源:helpers.py
示例9: post_process_group
def post_process_group(group, **kwargs):
"""
Fires post processing hooks for a group.
"""
for plugin in plugins.all():
if safe_execute(plugin.is_enabled, group.project):
plugin_post_process_group.delay(plugin.slug, group=group, **kwargs)
开发者ID:Epictetus,项目名称:sentry-1,代码行数:7,代码来源:post_process.py
示例10: manage_plugins
def manage_plugins(request, team, project):
result = plugins.first('has_perm', request.user, 'configure_project_plugin', project)
if result is False and not request.user.has_perm('sentry.can_change_project'):
return HttpResponseRedirect(reverse('sentry'))
if request.POST:
enabled = set(request.POST.getlist('plugin'))
for plugin in plugins.all():
if plugin.can_enable_for_projects():
plugin.set_option('enabled', plugin.slug in enabled, project)
messages.add_message(
request, messages.SUCCESS,
_('Your settings were saved successfully.'))
return HttpResponseRedirect(request.path)
context = csrf(request)
context.update({
'team': team,
'page': 'plugins',
'project': project,
'SECTION': 'team',
'SUBSECTION': 'projects'
})
return render_to_response('sentry/projects/plugins/list.html', context, request)
开发者ID:Caramel,项目名称:sentry,代码行数:27,代码来源:projects.py
示例11: notification_settings
def notification_settings(request):
forms = []
for plugin in plugins.all():
for form in safe_execute(plugin.get_notification_forms) or ():
form = safe_execute(form, plugin, request.user, request.POST or None)
if not form:
continue
helper = FormHelper()
helper.form_tag = False
forms.append((form, helper))
# Ensure our form comes first
helper = FormHelper()
helper.form_tag = False
forms = [
(NotificationSettingsForm(request.user, request.POST or None), helper),
] + forms
if request.POST:
if all(f.is_valid() for f, h in forms):
for form, helper in forms:
form.save()
response = HttpResponseRedirect(reverse('sentry-account-settings-notifications') + '?success=1')
return response
context = csrf(request)
context.update({
'forms': forms,
'page': 'notifications',
})
return render_to_response('sentry/account/notifications.html', context, request)
开发者ID:dz0ny,项目名称:sentry,代码行数:31,代码来源:accounts.py
示例12: manage_plugins
def manage_plugins(request, organization, project):
if request.POST:
enabled = set(request.POST.getlist('plugin'))
for plugin in plugins.all(version=None):
if plugin.can_enable_for_projects():
if plugin.slug in enabled:
plugin.enable(project)
else:
plugin.disable(project)
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': 'plugins',
'project': project,
})
return render_to_response('sentry/projects/plugins/list.html', context, request)
开发者ID:carriercomm,项目名称:sentry-1,代码行数:25,代码来源:plugins.py
示例13: get
def get(self, request, organization):
all_plugins = dict([
(p.slug, p) for p in plugins.all()
])
if 'plugins' in request.GET:
desired_plugins = set(request.GET.getlist('plugins'))
else:
desired_plugins = set(all_plugins.keys())
# Ignore plugins that are not available to this Sentry install.
desired_plugins = desired_plugins & set(all_plugins.keys())
# Each tuple represents an enabled Plugin (of only the ones we care
# about) and its corresponding Project.
enabled_plugins = ProjectOption.objects.filter(
key__in=['%s:enabled' % slug for slug in desired_plugins],
project__organization=organization,
).select_related('project')
resources = []
for project_option in enabled_plugins:
resources.append(
serialize(
all_plugins[project_option.key.split(':')[0]],
request.user,
OrganizationPluginSerializer(project_option.project),
)
)
return Response(resources)
开发者ID:alexandrul,项目名称:sentry,代码行数:32,代码来源:organization_plugins.py
示例14: notification_settings
def notification_settings(request):
forms = []
for plugin in plugins.all():
for form in safe_execute(plugin.get_notification_forms) or ():
form = safe_execute(form, plugin, request.user, request.POST or None)
if not form:
continue
helper = FormHelper()
helper.form_tag = False
forms.append((form, helper))
# Ensure our form comes first
helper = FormHelper()
helper.form_tag = False
forms = [(NotificationSettingsForm(request.user, request.POST or None), helper)] + forms
if request.POST:
if all(f.is_valid() for f, h in forms):
for form, helper in forms:
form.save()
messages.add_message(request, messages.SUCCESS, "Your settings were saved.")
return HttpResponseRedirect(request.path)
context = csrf(request)
context.update({"forms": forms, "page": "notifications"})
return render_to_response("sentry/account/notifications.html", context, request)
开发者ID:npk,项目名称:sentry,代码行数:26,代码来源:accounts.py
示例15: notification_settings
def notification_settings(request):
settings_form = NotificationSettingsForm(request.user, request.POST or None)
# TODO(dcramer): this is an extremely bad pattern and we need a more optimal
# solution for rendering this (that ideally plays well with the org data)
project_list = []
organization_list = Organization.objects.get_for_user(
user=request.user,
)
for organization in organization_list:
team_list = Team.objects.get_for_user(
user=request.user,
organization=organization,
)
for team in team_list:
project_list.extend(
Project.objects.get_for_user(
user=request.user,
team=team,
)
)
project_forms = [
(project, ProjectEmailOptionsForm(
project, request.user,
request.POST or None,
prefix='project-%s' % (project.id,)
))
for project in sorted(project_list, key=lambda x: (
x.team.name if x.team else None, x.name))
]
ext_forms = []
for plugin in plugins.all():
for form in safe_execute(plugin.get_notification_forms) or ():
form = safe_execute(form, plugin, request.user, request.POST or None, prefix=plugin.slug)
if not form:
continue
ext_forms.append(form)
if request.POST:
all_forms = list(itertools.chain(
[settings_form], ext_forms, (f for _, f in project_forms)
))
if all(f.is_valid() for f in all_forms):
for form in all_forms:
form.save()
messages.add_message(request, messages.SUCCESS, 'Your settings were saved.')
return HttpResponseRedirect(request.path)
context = csrf(request)
context.update({
'settings_form': settings_form,
'project_forms': project_forms,
'ext_forms': ext_forms,
'page': 'notifications',
'AUTH_PROVIDERS': get_auth_providers(),
})
return render_to_response('sentry/account/notifications.html', context, request)
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:59,代码来源:accounts.py
示例16: send_group_processors
def send_group_processors(group, **kwargs):
for inst in plugins.all():
try:
inst.post_process(group=group, **kwargs)
except:
transaction.rollback_unless_managed(using=group._state.db)
logger = logging.getLogger('sentry.plugins')
logger.exception('Error processing post_process() on %r', inst.__class__)
开发者ID:snkashis,项目名称:sentry,代码行数:8,代码来源:base.py
示例17: _get_plugin_value
def _get_plugin_value(self, feature, actor):
for plugin in plugins.all(version=2):
handlers = safe_execute(plugin.get_feature_hooks, _with_transaction=False)
for handler in handlers or ():
rv = handler(feature, actor)
if rv is not None:
return rv
return None
开发者ID:Kayle009,项目名称:sentry,代码行数:8,代码来源:manager.py
示例18: post_process_group
def post_process_group(group, **kwargs):
"""
Fires post processing hooks for a group.
"""
from sentry.plugins import plugins
from sentry.utils.safe import safe_execute
for plugin in plugins.all():
if safe_execute(plugin.is_enabled, group.project):
safe_execute(plugin.post_process, group=group, **kwargs)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:10,代码来源:post_process.py
示例19: get_tags
def get_tags(group, request):
tag_list = []
for inst in plugins.all():
try:
tag_list = inst.tags(request, group, tag_list)
except Exception, e:
logger = logging.getLogger('sentry.plugins')
logger.rror('Error processing tags() on %r: %s', inst.__class__, e, extra={
'request': request,
}, exc_info=True)
开发者ID:buriy,项目名称:django-sentry,代码行数:10,代码来源:sentry_helpers.py
示例20: handle_before_events
def handle_before_events(request, event_list):
if not hasattr(event_list, '__iter__'):
event_list = [event_list]
for inst in plugins.all():
try:
inst.before_events(request, event_list)
except Exception, e:
logger = logging.getLogger('sentry.plugins')
logger.error('Error processing before_events() on %r: %s', inst.__class__, e, extra={
'request': request,
}, exc_info=True)
开发者ID:buriy,项目名称:django-sentry,代码行数:11,代码来源:sentry_helpers.py
注:本文中的sentry.plugins.plugins.all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论