Example #1
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.
        """
        if not self.photo and self.privacy_photo >= self._privacy_level:
            return gravatar(self.user.email, size=geometry)
        return self.get_photo_thumbnail(geometry, **kwargs).url
Example #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)
Example #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)
Example #4
0
 def test_gravatar(self):
     avatar_url = gravatar('fo', size=80, rating='bar')
     eq_(avatar_url, ('https://secure.gravatar.com/avatar/eed8070249'
                      '39b808083f0031a56e9872?s=80&r=bar&d=http%3A%2F%'
                      '2Ffoobar%2Fmedia%2Fimg%2Funknown.png'))