if db lock fails, explicitly close database

on Windows at least, the database file otherwise remains locked after
an exception is raised on a read only file
This commit is contained in:
Damien Elmes 2019-12-24 19:12:59 +10:00
parent 4168c01141
commit 6a8ea9e65b

View file

@ -63,7 +63,11 @@ def Collection(
addBasicModel(col) addBasicModel(col)
col.save() col.save()
if lock: if lock:
col.lock() try:
col.lock()
except:
col.db.close()
raise
return col return col