소스 검색

[minor] encoding for has_gravatar

version-14
Rushabh Mehta 9 년 전
부모
커밋
a5156ec40c
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. +6
    -1
      frappe/utils/__init__.py

+ 6
- 1
frappe/utils/__init__.py 파일 보기

@@ -127,7 +127,12 @@ def has_gravatar(email):
# since querying gravatar for every item will be slow
return ''

gravatar_url = "https://secure.gravatar.com/avatar/{hash}?d=404&s=200".format(hash=md5.md5(email).hexdigest())
if not isinstance(email, unicode):
email = unicode(email, 'utf-8')

hexdigest = md5.md5(email).hexdigest()

gravatar_url = "https://secure.gravatar.com/avatar/{hash}?d=404&s=200".format(hash=hexdigest)
try:
res = requests.get(gravatar_url)
if res.status_code==200:


불러오는 중...
취소
저장