Browse Source

Merge pull request #1015 from versada/gravatar_https

[10.0][IMP] base_user_gravatar: changes to get Gravatars over HTTPS
pull/1020/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
b6245c15e8
  1. 2
      base_user_gravatar/__manifest__.py
  2. 2
      base_user_gravatar/models/res_users.py
  3. 2
      base_user_gravatar/tests/test_res_users.py

2
base_user_gravatar/__manifest__.py

@ -4,7 +4,7 @@
{ {
'name': 'Synchronize Gravatar Image', 'name': 'Synchronize Gravatar Image',
'version': '10.0.1.0.0',
'version': '10.0.1.0.1',
'author': 'LasLabs, Endika Iglesias, Odoo Community Association (OCA)', 'author': 'LasLabs, Endika Iglesias, Odoo Community Association (OCA)',
'category': 'Tools', 'category': 'Tools',
'website': 'https://odoo-community.org/', 'website': 'https://odoo-community.org/',

2
base_user_gravatar/models/res_users.py

@ -15,7 +15,7 @@ class ResUsers(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
def _get_gravatar_base64(self, email=''): def _get_gravatar_base64(self, email=''):
url = 'http://www.gravatar.com/avatar/{}?s=200'
url = 'https://www.gravatar.com/avatar/{}?s=200'
_hash = hashlib.md5(email).hexdigest() _hash = hashlib.md5(email).hexdigest()
try: try:
res = urllib2.urlopen(url.format(_hash)) res = urllib2.urlopen(url.format(_hash))

2
base_user_gravatar/tests/test_res_users.py

@ -24,7 +24,7 @@ class TestResUsers(TransactionCase):
'name': 'Test', 'name': 'Test',
'login': 'test_login', 'login': 'test_login',
} }
self.url = 'http://www.gravatar.com/avatar/{}?s=200'
self.url = 'https://www.gravatar.com/avatar/{}?s=200'
def _test_record(self, ): def _test_record(self, ):
partner_id = self.env['res.partner'].create(self.partner_vals) partner_id = self.env['res.partner'].create(self.partner_vals)

Loading…
Cancel
Save