Revert wrong changes on temporary_attribute_value
We don't want to ignore any error. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
08b30e8195
commit
4447ac5f1a
@ -34,12 +34,7 @@ def temporary_attribute_value(obj, attribute, value):
|
|||||||
"""Temporarily switch an object attribute value to another value."""
|
"""Temporarily switch an object attribute value to another value."""
|
||||||
original_value = getattr(obj, attribute)
|
original_value = getattr(obj, attribute)
|
||||||
setattr(obj, attribute, value)
|
setattr(obj, attribute, value)
|
||||||
|
|
||||||
try:
|
|
||||||
yield
|
yield
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
setattr(obj, attribute, original_value)
|
setattr(obj, attribute, original_value)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user