From 4733dc8994166eb32cd8f9ec0b8841e6700cbf0e Mon Sep 17 00:00:00 2001 From: j Date: Sun, 12 Mar 2017 14:50:13 +0200 Subject: [PATCH] text can be empty too --- pandora/document/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora/document/models.py b/pandora/document/models.py index 61f1f017..3bce72a9 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -352,7 +352,10 @@ class Document(models.Model): elif key == 'rightslevel': setattr(self, key, int(data[key])) elif ktype == 'text': - self.data[key] = ox.sanitize_html(data[key]) + if data[key]: + self.data[key] = ox.sanitize_html(data[key]) + else: + del self.data[key] elif ktype == '[text]': self.data[key] = [ox.sanitize_html(t) for t in data[key]] elif ktype == '[string]':