summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grc/core/utils/descriptors/evaluated.py3
-rw-r--r--grc/tests/test_evaled_property.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/grc/core/utils/descriptors/evaluated.py b/grc/core/utils/descriptors/evaluated.py
index 0e1b68761c..4f576820eb 100644
--- a/grc/core/utils/descriptors/evaluated.py
+++ b/grc/core/utils/descriptors/evaluated.py
@@ -66,8 +66,9 @@ class Evaluated(object):
def __set__(self, instance, value):
attribs = instance.__dict__
value = value or self.default
- if isinstance(value, six.text_type) and value.startswith('${') and value.endswith('}'):
+ if isinstance(value, six.string_types) and value.startswith('${') and value.endswith('}'):
attribs[self.name_raw] = value[2:-1].strip()
+ attribs.pop(self.name, None) # reset previous eval result
else:
attribs[self.name] = type(self.default)(value)
diff --git a/grc/tests/test_evaled_property.py b/grc/tests/test_evaled_property.py
index 27957cd291..468f16b8ea 100644
--- a/grc/tests/test_evaled_property.py
+++ b/grc/tests/test_evaled_property.py
@@ -56,6 +56,8 @@ def test_evaled():
assert a.foo == 11 and a.foo == 11
assert a.called['foo'] == 2
assert not a.errors
+ a.foo = u'${ 10 + 2 }'
+ assert a.foo == 12
def test_evaled_with_default():