variables: don't treat invalid json as formatted values (#26703)

This commit is contained in:
Frédéric Péters 2018-09-25 14:38:43 +02:00
parent b08256374d
commit fab9a4f56f
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,10 @@ class Variable(models.Model):
@property
def json(self):
if self.value and (self.value[0] in '{[' or self.value in ('true', 'false')):
return json.loads(self.value)
try:
return json.loads(self.value)
except ValueError:
pass
return self.value
def clean(self):