Sunday, June 27, 2010

concordance progress

While dredging through framework API design, its sometimes difficult to sense how close you are to finish. Tonight the Concordance "pure Python" redesign reached a critical point - being able to add an extension and respond to an XMPP <iq> stanza:

>>> import concordance
>>> import concordance.extensions.ping
>>> s = concordance.Service('host')
>>> s.append(concordance.extensions.ping.Ping)
>>> import xml.etree.ElementTree as et
>>> st = et.fromstring('<iq from="arc@host" id="f00" to="host" type="get"><ping xmlns="urn:xmpp:ping" /></iq>')
>>> s.stream(st)
<iq from="host" id="f00" to="arc@host" type="result" />
>>>

That's a correct response to an XMPP Ping request, one of the simplest XMPP extensions. Many of these basic extensions will be combined into a single extension module and a ready-made Service class, this is just proof that it works.

No comments: