• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python avatar.get_gravatar_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.utils.avatar.get_gravatar_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_gravatar_url函数的具体用法?Python get_gravatar_url怎么用?Python get_gravatar_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_gravatar_url函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: render_activity

def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
开发者ID:XuYong,项目名称:sentry,代码行数:27,代码来源:sentry_activity.py


示例2: serialize

    def serialize(self, obj, attrs, user):
        d = {
            'id': str(obj.id),
            'name': obj.get_display_name(),
            'username': obj.username,
            'email': obj.email,
            'avatarUrl': get_gravatar_url(obj.email, size=32),
        }
        if obj == user:
            options = {
                o.key: o.value
                for o in UserOption.objects.filter(
                    user=user,
                    project__isnull=True,
                )
            }
            stacktrace_order = int(options.get('stacktrace_order', -1) or -1)
            if stacktrace_order == -1:
                stacktrace_order = 'default'
            elif stacktrace_order == 2:
                stacktrace_order = 'newestFirst'
            elif stacktrace_order == 1:
                stacktrace_order = 'newestLast'

            d['options'] = {
                'language': options.get('language') or 'en',
                'stacktraceOrder': stacktrace_order,
                'timezone': options.get('timezone') or settings.SENTRY_DEFAULT_TIME_ZONE,
                'clock24Hours': options.get('clock_24_hours') or False,
            }
        return d
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:31,代码来源:user.py


示例3: serialize

    def serialize(self, obj, attrs, user):
        d = {
            'id': str(obj.id),
            'name': obj.get_display_name(),
            'username': obj.username,
            'email': obj.email,
            'avatarUrl': get_gravatar_url(obj.email, size=32),
            'isActive': obj.is_active,
            'isManaged': obj.is_managed,
            'dateJoined': obj.date_joined,
            'has2fa': attrs['has2fa'],
        }
        if obj == user:
            options = {
                o.key: o.value
                for o in UserOption.objects.filter(
                    user=user,
                    project__isnull=True,
                )
            }
            stacktrace_order = int(options.get('stacktrace_order', -1) or -1)
            if stacktrace_order == -1:
                stacktrace_order = 'default'
            elif stacktrace_order == 2:
                stacktrace_order = 'newestFirst'
            elif stacktrace_order == 1:
                stacktrace_order = 'newestLast'

            d['options'] = {
                'language': options.get('language') or 'en',
                'stacktraceOrder': stacktrace_order,
                'timezone': options.get('timezone') or settings.SENTRY_DEFAULT_TIME_ZONE,
                'clock24Hours': options.get('clock_24_hours') or False,
            }

        if attrs.get('avatar'):
            avatar = {
                'avatarType': attrs['avatar'].get_avatar_type_display(),
                'avatarUuid': attrs['avatar'].ident if attrs['avatar'].file else None
            }
        else:
            avatar = {'avatarType': 'letter_avatar', 'avatarUuid': None}
        d['avatar'] = avatar

        if attrs['identities'] is not None:
            d['identities'] = [{
                'id': i.ident,
                'organization': {
                    'slug': i.auth_provider.organization.slug,
                    'name': i.auth_provider.organization.name,
                },
                'provider': {
                    'id': i.auth_provider.provider,
                    'name': i.auth_provider.get_provider().name,
                },
                'dateSynced': i.last_synced,
                'dateVerified': i.last_verified,
            } for i in attrs['identities']]

        return d
开发者ID:Akashguharoy,项目名称:sentry,代码行数:60,代码来源:user.py


示例4: serialize

 def serialize(self, obj, attrs, user):
     d = {
         'id': str(obj.id),
         'name': obj.get_full_name(),
         'email': obj.email,
         'avatarUrl': get_gravatar_url(obj.email, size=32),
     }
     return d
开发者ID:BlueMoebius,项目名称:sentry,代码行数:8,代码来源:user.py


示例5: serialize

 def serialize(self, obj, attrs, user):
     return {
         'id': str(obj.id),
         'identifier': obj.ident,
         'username': obj.username,
         'email': obj.email,
         'ipAddress': obj.ip_address,
         'avatarUrl': get_gravatar_url(obj.email, size=32),
     }
开发者ID:280185386,项目名称:sentry,代码行数:9,代码来源:eventuser.py


示例6: serialize

 def serialize(self, obj, attrs, user):
     d = {
         'id': str(obj.id),
         'email': obj.email or obj.user.email,
         'access': obj.get_type_display(),
         'pending': obj.is_pending,
         'dateCreated': obj.date_added,
         'avatarUrl': get_gravatar_url(obj.email, size=32),
     }
     return d
开发者ID:BlueMoebius,项目名称:sentry,代码行数:10,代码来源:organization_member.py


示例7: serialize

 def serialize(self, obj, attrs, user):
     return {
         'id': six.text_type(obj.id),
         'hash': obj.hash,
         'tagValue': obj.tag_value,
         'identifier': obj.ident,
         'username': obj.username,
         'email': obj.email,
         'name': obj.get_display_name(),
         'ipAddress': obj.ip_address,
         'dateCreated': obj.date_added,
         'avatarUrl': get_gravatar_url(obj.email, size=32),
     }
开发者ID:Kayle009,项目名称:sentry,代码行数:13,代码来源:eventuser.py


示例8: serialize

    def serialize(self, obj, attrs, user):
        d = {
            'id': str(obj.id),
            'name': obj.get_display_name(),
            'username': obj.username,
            'email': obj.email,
            'avatarUrl': get_gravatar_url(obj.email, size=32),
            'isActive': obj.is_active,
            'dateJoined': obj.date_joined,
        }
        if obj == user:
            options = {
                o.key: o.value
                for o in UserOption.objects.filter(
                    user=user,
                    project__isnull=True,
                )
            }
            stacktrace_order = int(options.get('stacktrace_order', -1) or -1)
            if stacktrace_order == -1:
                stacktrace_order = 'default'
            elif stacktrace_order == 2:
                stacktrace_order = 'newestFirst'
            elif stacktrace_order == 1:
                stacktrace_order = 'newestLast'

            d['options'] = {
                'language': options.get('language') or 'en',
                'stacktraceOrder': stacktrace_order,
                'timezone': options.get('timezone') or settings.SENTRY_DEFAULT_TIME_ZONE,
                'clock24Hours': options.get('clock_24_hours') or False,
            }

        if attrs.get('avatar'):
            avatar = {
                'avatarType': attrs['avatar'].get_avatar_type_display(),
                'avatarUuid': attrs['avatar'].ident if attrs['avatar'].file else None
            }
        else:
            avatar = {'avatarType': 'letter_avatar', 'avatarUuid': None}
        d['avatar'] = avatar

        return d
开发者ID:JJediny,项目名称:sentry,代码行数:43,代码来源:user.py


示例9: render_activity

def render_activity(item):
    if not item.group:
        # not implemented
        return

    try:
        action_str = ACTIVITY_ACTION_STRINGS[item.type]
    except KeyError:
        logging.warning('Unknown activity type present: %s', item.type)
        return

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)
    elif item.type == Activity.ASSIGNED:
        if item.data['assignee'] == item.user_id:
            assignee_name = 'themselves'
        else:
            try:
                assignee = User.objects.get(id=item.data['assignee'])
            except User.DoesNotExist:
                assignee_name = 'unknown'
            else:
                assignee_name = assignee.get_display_name()
        action_str = action_str.format(user=assignee_name)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:42,代码来源:sentry_activity.py


示例10: render_activity

def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    output = ""

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += "<strong>%s</strong> %s" % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += "The system %s" % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.COMMENT:
        output += linebreaks(item.data["body"])

    return mark_safe(output)
开发者ID:TracyWebTech,项目名称:sentry,代码行数:24,代码来源:sentry_activity.py


示例11: gravatar_url

def gravatar_url(context, email, size=None, default='mm'):
    return get_gravatar_url(email, size, default)
开发者ID:AnguelSC,项目名称:sentry,代码行数:2,代码来源:sentry_helpers.py


示例12: serialize

    def serialize(self, obj, attrs, user):
        d = {
            'id': six.text_type(obj.id),
            'name': obj.get_display_name(),
            'username': obj.username,
            'email': obj.email,
            'avatarUrl': get_gravatar_url(obj.email, size=32),
            'isActive': obj.is_active,
            'hasPasswordAuth': obj.password not in ('!', ''),
            'isManaged': obj.is_managed,
            'dateJoined': obj.date_joined,
            'lastLogin': obj.last_login,
            'has2fa': attrs['has2fa'],
            'lastActive': obj.last_active,
        }

        if obj == user:
            options = {
                o.key: o.value for o in UserOption.objects.filter(
                    user=user,
                    project__isnull=True,
                )
            }
            stacktrace_order = int(options.get('stacktrace_order', -1) or -1)

            d['options'] = {
                'language': options.get('language') or 'en',
                'stacktraceOrder': stacktrace_order,
                'timezone': options.get('timezone') or settings.SENTRY_DEFAULT_TIME_ZONE,
                'clock24Hours': options.get('clock_24_hours') or False,
                'seenReleaseBroadcast': options.get('seen_release_broadcast'),
            }

            d['permissions'] = list(UserPermission.for_user(obj.id))

            d['flags'] = {
                'newsletter_consent_prompt': bool(obj.flags.newsletter_consent_prompt),
            }

        if attrs.get('avatar'):
            avatar = {
                'avatarType': attrs['avatar'].get_avatar_type_display(),
                'avatarUuid': attrs['avatar'].ident if attrs['avatar'].file_id else None
            }
        else:
            avatar = {'avatarType': 'letter_avatar', 'avatarUuid': None}
        d['avatar'] = avatar

        if attrs['identities'] is not None:
            d['identities'] = [
                {
                    'id': six.text_type(i.id),
                    'name': i.ident,
                    'organization': {
                        'slug': i.auth_provider.organization.slug,
                        'name': i.auth_provider.organization.name,
                    },
                    'provider': {
                        'id': i.auth_provider.provider,
                        'name': i.auth_provider.get_provider().name,
                    },
                    'dateSynced': i.last_synced,
                    'dateVerified': i.last_verified,
                } for i in attrs['identities']
            ]

        d['emails'] = [
            {
                'id': six.text_type(e.id),
                'email': e.email,
                'is_verified': e.is_verified,
            } for e in attrs['emails']
        ]

        return d
开发者ID:hosmelq,项目名称:sentry,代码行数:75,代码来源:user.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cache.delete函数代码示例发布时间:2022-05-27
下一篇:
Python auth.parse_auth_header函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap