don't throw error when upgrading collection with unused models

This commit is contained in:
Damien Elmes 2012-07-04 19:45:08 +09:00
parent c3aed57df5
commit 9f2cf172f9

View file

@ -600,7 +600,12 @@ and ord = ? limit 1""", m['id'], t['ord']):
remove.append(t)
del t['actv']
for r in remove:
d.models.remTemplate(m, r)
try:
d.models.remTemplate(m, r)
except AssertionError:
# if the model was unused this could result in all
# templates being removed; ignore error
pass
d.models.save(m)
# Conditional templates