File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 11# pylint: disable=bare-except
22
3- import hashlib
4- import urllib
5-
63from conditional import app
74from conditional .models .models import FreshmanAccount
85from conditional .util .cache import service_cache
@@ -34,31 +31,11 @@ def check_current_student(username):
3431 return ldap_is_current_student (member )
3532
3633
37- @service_cache (maxsize = 256 )
38- def get_rit_image (username : str ) -> str :
39- if username :
40- addresses = [username + "@rit.edu" , username + "@g.rit.edu" ]
41- for addr in addresses :
42- url = (
43- "https://gravatar.com/avatar/"
44- + hashlib .md5 (addr .encode ("utf8" )).hexdigest ()
45- + ".jpg?d=404&s=250"
46- )
47- try :
48- with urllib .request .urlopen (url ) as gravatar :
49- if gravatar .getcode () == 200 :
50- return url
51- except :
52- continue
53- return "https://www.gravatar.com/avatar/freshmen?d=mp&f=y"
54-
55-
5634@app .context_processor
5735def utility_processor ():
5836 return {
5937 "get_csh_name" : get_csh_name ,
6038 "get_freshman_name" : get_freshman_name ,
61- "get_rit_image" : get_rit_image ,
6239 "get_member_name" : get_member_name ,
6340 "check_current_student" : check_current_student ,
6441 }
You can’t perform that action at this time.
0 commit comments