当前位置: 首页>>代码示例>>Python>>正文


Python EventUser.get_label方法代码示例

本文整理汇总了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
开发者ID:Kayle009,项目名称:sentry,代码行数:46,代码来源:snuba.py


注:本文中的sentry.models.EventUser.get_label方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。