Exemple #1
0
 def test_gravatar(self):
     avatar_url = helpers.gravatar("fo", size=80, rating="bar")
     eq_(
         avatar_url,
         ("https://secure.gravatar.com/avatar/eed8070249"
          "39b808083f0031a56e9872?s=80&r=bar&d="
          "%2Fmedia%2Fimg%2Fdefault_avatar.png"),
     )
Exemple #2
0
    def get_photo_url(self, geometry='160x160', **kwargs):
        """Return photo url.

        If privacy allows and no photo set, return gravatar link.
        If privacy allows and photo set return local photo link.
        If privacy doesn't allow return default local link.
        """
        privacy_level = getattr(self, '_privacy_level', MOZILLIANS)
        if (not self.photo and self.privacy_photo >= privacy_level):
            return gravatar(self.user.email, size=geometry)
        return absolutify(self.get_photo_thumbnail(geometry, **kwargs).url)
Exemple #3
0
    def get_photo_url(self, geometry='160x160', **kwargs):
        """Return photo url.

        If privacy allows and no photo set, return gravatar link.
        If privacy allows and photo set return local photo link.
        If privacy doesn't allow return default local link.
        """
        privacy_level = getattr(self, '_privacy_level', MOZILLIANS)
        if (not self.photo and self.privacy_photo >= privacy_level):
            return gravatar(self.user.email, size=geometry)
        return absolutify(self.get_photo_thumbnail(geometry, **kwargs).url)
 def test_gravatar(self):
     avatar_url = helpers.gravatar('fo', size=80, rating='bar')
     eq_(avatar_url, ('https://secure.gravatar.com/avatar/eed8070249'
                      '39b808083f0031a56e9872?s=80&r=bar&d='
                      '%2Fmedia%2Fimg%2Fdefault_avatar.png'))
 def test_gravatar(self):
     avatar_url = helpers.gravatar('fo', size=80, rating='bar')
     eq_(avatar_url, ('https://secure.gravatar.com/avatar/eed8070249'
                      '39b808083f0031a56e9872?s=80&r=bar&d='
                      '%2Fmedia%2Fimg%2Fdefault_avatar.png'))