changeset 2784:76ebecdb9b1e

plugin pubsub schema: handle XHTML fields
author Goffi <goffi@goffi.org>
date Sat, 19 Jan 2019 11:39:02 +0100
parents 442ab697f831
children f18d8315929e
files sat/plugins/plugin_exp_pubsub_schema.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_exp_pubsub_schema.py	Sat Jan 19 11:39:02 2019 +0100
+++ b/sat/plugins/plugin_exp_pubsub_schema.py	Sat Jan 19 11:39:02 2019 +0100
@@ -372,17 +372,19 @@
             ):
                 values_list = [values_list]
             if deserialise:
-                if field.fieldType == "boolean":
+                if field.fieldType == u"boolean":
                     values_list = [C.bool(v) for v in values_list]
-                elif field.fieldType == "text-multi":
+                elif field.fieldType == u"text-multi":
                     # for text-multi, lines must be put on separate values
                     values_list = list(
                         itertools.chain(*[v.splitlines() for v in values_list])
                     )
-
-                elif "jid" in field.fieldType:
+                elif xml_tools.isXHTMLField(field):
+                   values_list = [generic.parseXml(v.encode("utf-8"))
+                                  for v in values_list]
+                elif u"jid" in (field.fieldType or u""):
                     values_list = [jid.JID(v) for v in values_list]
-            if "list" in field.fieldType:
+            if u"list" in (field.fieldType or u""):
                 # for lists, we check that given values are allowed in form
                 allowed_values = [o.value for o in field.options]
                 values_list = [v for v in values_list if v in allowed_values]