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:
Julien Danjou 2013-04-24 22:06:53 +02:00
parent 08b30e8195
commit 4447ac5f1a

View File

@ -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)