def _get_unversioned_avatar_url(user_profile_id, avatar_source, realm_id, email=None, medium=False): # type: (int, Text, int, Optional[Text], bool) -> Text if avatar_source == u'U': hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) return upload_backend.get_avatar_url(hash_key, medium=medium) assert email is not None return _get_unversioned_gravatar_url(email, medium)
def _get_unversioned_avatar_url(user_profile_id, avatar_source, realm_id, email=None, medium=False): # type: (int, Text, int, Optional[Text], bool) -> Text if avatar_source == u'U': hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) return upload_backend.get_avatar_url(hash_key, medium=medium) assert email is not None return _get_unversioned_gravatar_url(email, medium)
def _get_unversioned_avatar_url(user_profile_id: int, avatar_source: str, realm_id: int, email: Optional[str]=None, medium: bool=False) -> str: if avatar_source == 'U': hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) return upload_backend.get_avatar_url(hash_key, medium=medium) assert email is not None return _get_unversioned_gravatar_url(email, medium)
def _get_unversioned_avatar_url(user_profile_id: int, avatar_source: str, realm_id: int, email: Optional[str] = None, medium: bool = False) -> str: if avatar_source == 'U': hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) return upload_backend.get_avatar_url(hash_key, medium=medium) assert email is not None return _get_unversioned_gravatar_url(email, medium)
def get_avatar_url(avatar_source, email): # type: (text_type, text_type) -> text_type if avatar_source == u'U': hash_key = user_avatar_hash(email) return upload_backend.get_avatar_url(hash_key) elif settings.ENABLE_GRAVATAR: hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon" % (hash_key,) else: return settings.DEFAULT_AVATAR_URI+'?x=x'
def _get_unversioned_avatar_url(avatar_source, email, medium=False): # type: (Text, Text, bool) -> Text if avatar_source == u'U': hash_key = user_avatar_hash(email) return upload_backend.get_avatar_url(hash_key, medium=medium) elif settings.ENABLE_GRAVATAR: gravitar_query_suffix = "&s=%s" % (MEDIUM_AVATAR_SIZE,) if medium else "" hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon%s" % (hash_key, gravitar_query_suffix) else: return settings.DEFAULT_AVATAR_URI+'?x=x'
def get_avatar_url(avatar_source, email, medium=False): # type: (text_type, text_type, bool) -> text_type if avatar_source == u"U": hash_key = user_avatar_hash(email) return upload_backend.get_avatar_url(hash_key, medium=medium) elif settings.ENABLE_GRAVATAR: gravitar_query_suffix = "&s=%s" % (MEDIUM_AVATAR_SIZE,) if medium else "" hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon%s" % (hash_key, gravitar_query_suffix) else: return settings.DEFAULT_AVATAR_URI + "?x=x"
def get_avatar_url(avatar_source, email): # type: (text_type, text_type) -> text_type if avatar_source == u'U': hash_key = user_avatar_hash(email) return upload_backend.get_avatar_url(hash_key) elif settings.ENABLE_GRAVATAR: hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon" % ( hash_key, ) else: return settings.DEFAULT_AVATAR_URI + '?x=x'
def _get_unversioned_avatar_url(avatar_source, email=None, realm_id=None, user_profile_id=None, medium=False): # type: (Text, Text, Optional[int], Optional[int], bool) -> Text if avatar_source == u'U': if user_profile_id is not None and realm_id is not None: # If we can, avoid doing a database query to fetch user_profile hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) else: user_profile = get_user_profile_by_email(email) hash_key = user_avatar_path(user_profile) return upload_backend.get_avatar_url(hash_key, medium=medium) elif settings.ENABLE_GRAVATAR: gravitar_query_suffix = "&s=%s" % (MEDIUM_AVATAR_SIZE,) if medium else "" hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon%s" % (hash_key, gravitar_query_suffix) else: return settings.DEFAULT_AVATAR_URI+'?x=x'
def _get_unversioned_avatar_url(avatar_source, email=None, realm_id=None, user_profile_id=None, medium=False): # type: (Text, Text, Optional[int], Optional[int], bool) -> Text if avatar_source == u'U': if user_profile_id is not None and realm_id is not None: # If we can, avoid doing a database query to fetch user_profile hash_key = user_avatar_path_from_ids(user_profile_id, realm_id) else: user_profile = get_user_profile_by_email(email) hash_key = user_avatar_path(user_profile) return upload_backend.get_avatar_url(hash_key, medium=medium) elif settings.ENABLE_GRAVATAR: gravitar_query_suffix = "&s=%s" % ( MEDIUM_AVATAR_SIZE, ) if medium else "" hash_key = gravatar_hash(email) return u"https://secure.gravatar.com/avatar/%s?d=identicon%s" % ( hash_key, gravitar_query_suffix) else: return settings.DEFAULT_AVATAR_URI + '?x=x'