diff --git a/calculate/lib/datavars.py b/calculate/lib/datavars.py index ffae995..bf36bdc 100644 --- a/calculate/lib/datavars.py +++ b/calculate/lib/datavars.py @@ -263,15 +263,15 @@ class Variable: section = self.parent.iniCache[self.name]['section'] value = self.parent.unserialize(self.type, value.encode('utf-8')) - try: - if self.mode == READONLY: - raise VariableError( - _("Attempt to rewrite readonly variable %s")% - varname) - else: + if self.mode == READONLY: + raise VariableError( + _("Attempt to rewrite readonly variable %s")% + self.name) + else: + try: self._set(value) - except Exception as e: - return False + except Exception as e: + return False return True def _get(self):