[JDEV] Problem with PyJabber
mallum
breakfast at 10.am
Thu Dec 6 13:26:09 CST 2001
Have you checked out jabberpy [1], Its nearing a 0.3 release and the
cvs version has support for *most* of the standard protocol and
components. The examples directory also contains a maturing pygtk
client.
-- mallum
[1] http://jabberpy.sourceforge.net
on Wed, Dec 05, 2001 at 05:03:35PM +0100, Zoe Drey wrote:
> Hi,
> Does someone work with PyJabber here?
> In this case, you can read the following :(sorry, my english
> is not very good...)
>
> I'm using PyJabber and have a problem with printing
> the xml string associated with a JabberPacket:
> I'm using the output() method for that, but for the following packet:
> <iq xmlns='jabber:client' type='result' id='pthsock_client_auth_ID'/>,
> output() doesn't seem to "work":
>
> when i put in my code:
>
> ==========================
> p.element_tree().output(), where p is a JabberPackets.IQ instance,
> ==========================
> i get the following error:
>
> ======================================================================
> [...]
> File "/home/zoe/logilab/nlp/PyJabber/Element.py", line 156, in output
> textlist.append(e.output(depth, name[0]))
> AttributeError: 'None' object has no attribute 'output'
> =================^^^^^^^^^^^==========================================
>
> p.element_tree() gives me:
> {'id': 'pthsock_client_auth_ID','type': 'result'}
>
> so to correct the error, there's a tiny modification to make in output()
> method, ---but i'm not sure if i'm right or not by doing that---
> to stop recursive calls when needed.
>
> ===========================================================
> for e in self.children: #Loop through nested elements
> if depth >= 0:
> textlist.append(e.output(depth + 1, name[0]))
> elif e is not None:
> textlist.append(e.output(depth, name[0]))
> ===============================================================
>
> instead of:
>
> ===========================================================
> for e in self.children: #Loop through nested elements
> if depth >= 0:
> textlist.append(e.output(depth + 1, name[0]))
> else:
> textlist.append(e.output(depth, name[0]))
> ===============================================================
>
>
> --
> Zo? Drey
>
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev
More information about the JDev
mailing list