Merge branch 'fix-0004-field-type' into 'master'

Fix 0004 field type

See merge request poezio/slixmpp!148
This commit is contained in:
mathieui 2021-03-08 21:10:20 +01:00
commit e97f5ccb9c
3 changed files with 10 additions and 8 deletions

View file

@ -48,7 +48,8 @@ class Form(ElementBase):
fields = self.get_fields() fields = self.get_fields()
for var in fields: for var in fields:
field = fields[var] field = fields[var]
del field['type'] if field['type'] != 'hidden':
del field['type']
del field['label'] del field['label']
del field['desc'] del field['desc']
del field['required'] del field['required']
@ -74,7 +75,8 @@ class Form(ElementBase):
for option in options: for option in options:
field.add_option(**option) field.add_option(**option)
else: else:
del field['type'] if field['type'] != 'hidden':
del field['type']
self.append(field) self.append(field)
return field return field

View file

@ -314,7 +314,7 @@ class TestPubsubStanzas(SlixTest):
<create node="testnode2" /> <create node="testnode2" />
<configure> <configure>
<x xmlns="jabber:x:data" type="submit"> <x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#node_config</value> <value>http://jabber.org/protocol/pubsub#node_config</value>
</field> </field>
<field var="pubsub#node_type"> <field var="pubsub#node_type">

View file

@ -72,7 +72,7 @@ class TestStreamPubsub(SlixTest):
<field var="pubsub#access_model"> <field var="pubsub#access_model">
<value>whitelist</value> <value>whitelist</value>
</field> </field>
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#node_config</value> <value>http://jabber.org/protocol/pubsub#node_config</value>
</field> </field>
</x> </x>
@ -210,7 +210,7 @@ class TestStreamPubsub(SlixTest):
<subscribe node="somenode" jid="tester@localhost" /> <subscribe node="somenode" jid="tester@localhost" />
<options> <options>
<x xmlns="jabber:x:data" type="submit"> <x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#subscribe_options</value> <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
</field> </field>
<field var="pubsub#digest"> <field var="pubsub#digest">
@ -358,7 +358,7 @@ class TestStreamPubsub(SlixTest):
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
<configure node="somenode"> <configure node="somenode">
<x xmlns="jabber:x:data" type="submit"> <x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#node_config</value> <value>http://jabber.org/protocol/pubsub#node_config</value>
</field> </field>
<field var="pubsub#title"> <field var="pubsub#title">
@ -441,7 +441,7 @@ class TestStreamPubsub(SlixTest):
</publish> </publish>
<publish-options> <publish-options>
<x xmlns="jabber:x:data" type="submit"> <x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#publish-options</value> <value>http://jabber.org/protocol/pubsub#publish-options</value>
</field> </field>
<field var="pubsub#access_model"> <field var="pubsub#access_model">
@ -622,7 +622,7 @@ class TestStreamPubsub(SlixTest):
<pubsub xmlns="http://jabber.org/protocol/pubsub"> <pubsub xmlns="http://jabber.org/protocol/pubsub">
<options node="somenode" jid="tester@localhost"> <options node="somenode" jid="tester@localhost">
<x xmlns="jabber:x:data" type="submit"> <x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE"> <field var="FORM_TYPE" type="hidden">
<value>http://jabber.org/protocol/pubsub#subscribe_options</value> <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
</field> </field>
<field var="pubsub#digest"> <field var="pubsub#digest">