XEP-0004: stanza, only delete field type if it is not 'hidden'
Not strictly required, but most XEPs use it like that for forms of type='submit', and that makes it easier to write stanza tests.
This commit is contained in:
		| @@ -48,7 +48,8 @@ class Form(ElementBase): | ||||
|             fields = self.get_fields() | ||||
|             for var in fields: | ||||
|                 field = fields[var] | ||||
|                 del field['type'] | ||||
|                 if field['type'] != 'hidden': | ||||
|                     del field['type'] | ||||
|                 del field['label'] | ||||
|                 del field['desc'] | ||||
|                 del field['required'] | ||||
| @@ -74,7 +75,8 @@ class Form(ElementBase): | ||||
|                 for option in options: | ||||
|                     field.add_option(**option) | ||||
|         else: | ||||
|             del field['type'] | ||||
|             if field['type'] != 'hidden': | ||||
|                 del field['type'] | ||||
|         self.append(field) | ||||
|         return field | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 mathieui
					mathieui