[FIX] ir.attachment: no crash on missing file with bin_size=True

When bin_size=True is passed, `os.path.getsize()` raises an OSError
rather than IOError when the file cannot be found.
This commit is contained in:
Olivier Dony
2015-11-02 12:55:30 +01:00
parent b7c1a9b288
commit 035a0ee412
+1 -1
View File
@@ -149,7 +149,7 @@ class ir_attachment(osv.osv):
r = os.path.getsize(full_path)
else:
r = open(full_path,'rb').read().encode('base64')
except IOError:
except (IOError, OSError):
_logger.info("_read_file reading %s", full_path, exc_info=True)
return r