Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

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

Closed
Jajcus opened this issue May 3, 2011 · 1 comment

Comments

@Jajcus
Copy link
Owner

Jajcus commented May 3, 2011

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:
    
    }}}
@Jajcus
Copy link
Owner Author

Jajcus commented May 3, 2011

(In [710]) - Option.label and Field.type are optional. Patch by Stelminator. closes #8

--jajcus

@Jajcus Jajcus closed this as completed May 3, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant