Ticket #8 (new defect)

Opened 3 years ago

Last modified 6 months ago

Optional attributes always being set in dataforms.Option and dataforms.Field

Reported by: Stelminator@… Owned by: jajcus
Priority: trivial Component: pyxmpp
Keywords: dataforms 0004 Cc:

Description

dataforms.Option.label and dataforms.Field.type are optional as per JEP-0004

dataforms.py always attaches these attributes when building the xml.

patch below:

Index: pyxmpp/jabber/dataforms.py
===================================================================
--- pyxmpp/jabber/dataforms.py	(revision 661)
+++ pyxmpp/jabber/dataforms.py	(working copy)
@@ -70,7 +70,8 @@
             - `xmlnode`: `libxml2.xmlNode`
             - `doc`: `libxml2.xmlDoc`"""
         _unused = doc
-        xmlnode.setProp("label", self.label.encode("utf-8"))
+        if self.label is not None:
+            xmlnode.setProp("label", self.label.encode("utf-8"))
         for value in self.values:
             xmlnode.newTextChild(xmlnode.ns(), "value", value.encode("utf-8"))
         return xmlnode
@@ -259,7 +260,8 @@
             - `doc`: `libxml2.xmlDoc`"""
         if self.type is not None and self.type not in self.allowed_types:
             raise ValueError, "Invalid form field type: %r" % (self.type,)
-        xmlnode.setProp("type", self.type)
+        if self.type is not None:
+            xmlnode.setProp("type", self.type)
         if not self.label is None:
             xmlnode.setProp("label", self.label)
         if not self.name is None:

Attachments

Change History

Changed 10 months ago by impotence help with cialis

Changed 10 months ago by Cialis hcl compared to lortab

Add/Change #8 (Optional attributes always being set in dataforms.Option and dataforms.Field)

Author


E-mail address and user name can be saved in the Preferences.


Action
as new
 
Note: See TracTickets for help on using tickets.