According to XEP-0004: - if there is no "type" attribute on a <field />, we should assume it is "text-single"; - "text-single" MUST NOT contain morethan one <value />. Before this patch, not specifying a field type and passing a multi-line string would result in an illegal stanza. While it would be cleaner to log a warning or even raise an exception if set_value() is called with an incompatible type, this breaks a lot of tests and backward-compatibility, so we introduce some heuristic in FormField.set_value() to infer the field type based on the provided value instead. I also changed FormField.get_value() so that it returns a list by default for 'text-multi' fields. This is a breaking change, but I have not found the justification for the previous behaviour.
8.4 KiB
8.4 KiB