diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 6383c3d7e..55cb04f42 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -61,10 +61,9 @@ class Annotation(models.Model): set_public_id = not self.id or not self.public_id layer = self.get_layer() if self.value: - self.value = utils.cleanup_value(self.value, self.layer['type']) + self.value = utils.cleanup_value(self.value, layer['type']) self.findvalue = ox.stripTags(self.value).strip() - sortvalue = self.findvalue - sortvalue = sort_string(sortvalue) + sortvalue = sort_string(self.findvalue) if sortvalue: self.sortvalue = sortvalue[:1000] else: diff --git a/pandora/annotation/utils.py b/pandora/annotation/utils.py index 95328d7a0..b7a3980fa 100644 --- a/pandora/annotation/utils.py +++ b/pandora/annotation/utils.py @@ -14,5 +14,5 @@ def cleanup_value(value, layer_type): return value def sanitize_fragment(html): - return html5lib.parseFragment(html).toxml() + return html5lib.parseFragment(html).toxml().decode('utf-8')