# HG changeset patch # User Goffi # Date 1547894342 -3600 # Node ID 76ebecdb9b1e7bfeca1bb75ee452ae0762471c3c # Parent 442ab697f831a92a454c040f112b9b7d20ebf2d7 plugin pubsub schema: handle XHTML fields diff -r 442ab697f831 -r 76ebecdb9b1e sat/plugins/plugin_exp_pubsub_schema.py --- 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]