本文整理汇总了Python中sentry.models.EventUser.get_label方法的典型用法代码示例。如果您正苦于以下问题:Python EventUser.get_label方法的具体用法?Python EventUser.get_label怎么用?Python EventUser.get_label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.models.EventUser
的用法示例。
在下文中一共展示了EventUser.get_label方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: serialize_eventusers
# 需要导入模块: from sentry.models import EventUser [as 别名]
# 或者: from sentry.models.EventUser import get_label [as 别名]
def serialize_eventusers(organization, item_list, user, lookup):
if not item_list:
return {}
# We have no reliable way to map the tag value format
# back into real EventUser rows. EventUser is only unique
# per-project, and this is an organization aggregate.
# This means a single value maps to multiple rows.
filters = reduce(or_, [
Q(hash=EventUser.hash_from_tag(tag), project_id=project)
for tag, project in item_list
])
eu_by_key = {
(eu.tag_value, eu.project_id): eu
for eu in EventUser.objects.filter(filters)
}
projects = serialize_projects(organization, {i[1] for i in item_list}, user)
rv = {}
for tag, project in item_list:
eu = eu_by_key.get((tag, project))
if eu is None:
attr, value = tag.split(':', 1)
eu = EventUser(project_id=project, **{EventUser.attr_from_keyword(attr): value})
rv[(tag, project)] = {
HEALTH_ID_KEY: make_health_id(lookup, [eu.tag_value, eu.project_id]),
'value': {
'id': six.text_type(eu.id) if eu.id else None,
'project': projects.get(eu.project_id),
'hash': eu.hash,
'tagValue': eu.tag_value,
'identifier': eu.ident,
'username': eu.username,
'email': eu.email,
'ipAddress': eu.ip_address,
'dateCreated': eu.date_added,
'label': eu.get_label(),
'name': eu.get_display_name(),
'geo': geo_by_addr(eu.ip_address),
},
}
return rv