comparison src/browser/libervia_main.py @ 701:9aa2e251a993

browser side: when there is no avatar in cache in getAvatarURL, set its value to empty string to avoid requesting again
author Goffi <goffi@goffi.org>
date Wed, 27 May 2015 19:11:25 +0200
parents b81816f42c81
children 531eacb82e9f
comparison
equal deleted inserted replaced
700:b81816f42c81 701:9aa2e251a993
229 """ 229 """
230 assert isinstance(jid_, jid.JID) 230 assert isinstance(jid_, jid.JID)
231 contact_list = self.contact_list # pyjamas issue: need a temporary variable to call a property's method 231 contact_list = self.contact_list # pyjamas issue: need a temporary variable to call a property's method
232 avatar_hash = contact_list.getCache(jid_, 'avatar') 232 avatar_hash = contact_list.getCache(jid_, 'avatar')
233 if avatar_hash is None: 233 if avatar_hash is None:
234 # we set to empty string to avoid requesting vcard several times
235 contact_list.setCache(jid_, 'avatar', '')
234 # we have no value for avatar_hash, so we request the vcard 236 # we have no value for avatar_hash, so we request the vcard
235 self.bridge.getCard(unicode(jid_), profile=C.PROF_KEY_NONE) 237 self.bridge.getCard(unicode(jid_), profile=C.PROF_KEY_NONE)
236 if not avatar_hash: 238 if not avatar_hash:
237 return C.DEFAULT_AVATAR_URL 239 return C.DEFAULT_AVATAR_URL
238 ret = os.path.join(C.AVATARS_DIR, avatar_hash) 240 ret = os.path.join(C.AVATARS_DIR, avatar_hash)