Mercurial > libervia-web
comparison src/server/blog.py @ 606:7af8f4ab3675 frontends_multi_profiles
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 09 Feb 2015 21:55:16 +0100 |
parents | e588335b6aa8 |
children | a90cc8fc9605 |
comparison
equal
deleted
inserted
replaced
605:917e271975d9 | 606:7af8f4ab3675 |
---|---|
94 try: | 94 try: |
95 entity_jid_s = [key for (key, value) in self.waiting_deferreds.items() if value[0] == action_id][0] | 95 entity_jid_s = [key for (key, value) in self.waiting_deferreds.items() if value[0] == action_id][0] |
96 except IndexError: # impossible to guess the entity | 96 except IndexError: # impossible to guess the entity |
97 return | 97 return |
98 log.debug(_("Using default avatar for entity %s") % entity_jid_s) | 98 log.debug(_("Using default avatar for entity %s") % entity_jid_s) |
99 self.avatars_cache[entity_jid_s] = C.DEFAULT_AVATAR | 99 self.avatars_cache[entity_jid_s] = C.DEFAULT_AVATAR_URL |
100 self.waiting_deferreds[entity_jid_s][1].callback(C.DEFAULT_AVATAR) | 100 self.waiting_deferreds[entity_jid_s][1].callback(C.DEFAULT_AVATAR_URL) |
101 del self.waiting_deferreds[entity_jid_s] | 101 del self.waiting_deferreds[entity_jid_s] |
102 | 102 |
103 def getAvatar(self, profile): | 103 def getAvatar(self, profile): |
104 """Get the avatar of the given profile | 104 """Get the avatar of the given profile |
105 | 105 |
106 @param profile (str): | 106 @param profile(unicode): %(doc_profile)s |
107 @return: deferred avatar path, relative to the server's root | 107 @return: deferred avatar path, relative to the server's root |
108 """ | 108 """ |
109 jid_s = (profile + '@' + self.host.bridge.getNewAccountDomain()).lower() | 109 jid_s = (profile + '@' + self.host.bridge.getNewAccountDomain()).lower() |
110 if jid_s in self.avatars_cache: | 110 if jid_s in self.avatars_cache: |
111 return defer.succeed(self.avatars_cache[jid_s]) | 111 return defer.succeed(self.avatars_cache[jid_s]) |