--- a/devtools/testlib.py Thu Oct 08 18:09:10 2015 +0200
+++ b/devtools/testlib.py Thu Oct 08 18:24:09 2015 +0200
@@ -719,12 +719,14 @@
origperms = erschema.permissions[action]
erschema.set_action_permissions(action, actionperms)
torestore.append([erschema, action, origperms])
- yield
- for erschema, action, permissions in torestore:
- if action is None:
- erschema.permissions = permissions
- else:
- erschema.set_action_permissions(action, permissions)
+ try:
+ yield
+ finally:
+ for erschema, action, permissions in torestore:
+ if action is None:
+ erschema.permissions = permissions
+ else:
+ erschema.set_action_permissions(action, permissions)
def assertModificationDateGreater(self, entity, olddate):
entity.cw_attr_cache.pop('modification_date', None)