本文整理汇总了Python中sentry.models.EventUser.for_tags方法的典型用法代码示例。如果您正苦于以下问题:Python EventUser.for_tags方法的具体用法?Python EventUser.for_tags怎么用?Python EventUser.for_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.models.EventUser
的用法示例。
在下文中一共展示了EventUser.for_tags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_for_tags
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import for_tags [as 别名]
def test_for_tags(self):
eu = EventUser.objects.create(
project_id=1,
ident='matt',
)
assert EventUser.for_tags(1, ['id:matt']) == {'id:matt': eu}
assert EventUser.for_tags(1, ['id:doesnotexist']) == {}
assert EventUser.for_tags(1, ['id:matt', 'id:doesnotexist']) == {'id:matt': eu}
示例2: find_event_user
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import for_tags [as 别名]
def find_event_user(self, report):
try:
event = Event.objects.get(
group_id=report.group_id,
event_id=report.event_id,
)
except Event.DoesNotExist:
if not report.email:
return None
try:
return EventUser.objects.filter(
project_id=report.project_id,
email=report.email,
)[0]
except IndexError:
return None
tag = event.get_tag('sentry:user')
if not tag:
return None
try:
return EventUser.for_tags(
project_id=report.project_id,
values=[tag],
)[tag]
except KeyError:
pass
示例3: get_attrs
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import for_tags [as 别名]
def get_attrs(self, item_list, user):
users = EventUser.for_tags(project_id=item_list[0].project_id, values=[t.value for t in item_list])
result = {}
for item in item_list:
result[item] = {"user": users.get(item.value)}
return result
示例4: get_attrs
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import for_tags [as 别名]
def get_attrs(self, item_list, user):
users = EventUser.for_tags(
project_id=self.project_id,
values=[t.value for t in item_list],
)
result = {}
for item in item_list:
result[item] = {
'user': users.get(item.value),
}
return result
示例5: wrapped
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import for_tags [as 别名]
def wrapped(items):
users = EventUser.for_tags(project_id, [i.value for i in items])
for item in items:
item._eventuser = users.get(item.value)