summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-01-25 15:42:51 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-01-25 15:42:51 +0100
commit4c2eee6a133785ac651b4818977661d0ac6008dd (patch)
tree44229973681c7ac322c4b7d60f22db12d8144aa5
parente61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df (diff)
downloadpoezio-4c2eee6a133785ac651b4818977661d0ac6008dd.tar.gz
poezio-4c2eee6a133785ac651b4818977661d0ac6008dd.tar.bz2
poezio-4c2eee6a133785ac651b4818977661d0ac6008dd.tar.xz
poezio-4c2eee6a133785ac651b4818977661d0ac6008dd.zip
Fix caching newer avatars.
-rw-r--r--poezio/core/handlers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index a7a0797b..59ab9f37 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -427,10 +427,11 @@ class HandlerCore:
# Now we save the data on the file system to not have to request it again.
try:
- makedirs(cache_dir)
+ makedirs(cache_dir, exist_ok=True)
with open(cached_path, 'wb') as avatar_file:
avatar_file.write(contact.avatar)
except OSError:
+ log.debug('Failed writing %s avatar to cache:', jid, exc_info=True)
pass
return
@@ -467,10 +468,11 @@ class HandlerCore:
# Now we save the data on the file system to not have to request it again.
try:
- makedirs(cache_dir)
+ makedirs(cache_dir, exist_ok=True)
with open(cached_path, 'wb') as avatar_file:
avatar_file.write(contact.avatar)
except OSError:
+ log.debug('Failed writing %s avatar to cache:', jid, exc_info=True)
pass
def on_nick_received(self, message):