Beispiel #1
0
 def __init__(self, xfrom, xto, tagname, xmlns=None, content=None, **attr):
     Element.__init__(self, tagname, xmlns, content, **attr)
     self._routing = ''
     if xfrom:
         self._routing += ' from=%s' % xml.sax.saxutils.quoteattr(xfrom)
     if xto:
         self._routing += ' to=%s' % xml.sax.saxutils.quoteattr(xto)
Beispiel #2
0
 def __unicode__(self):
     """
     Convert the element into an XML unicode string.
     """
     args = 'type="result"'
     if self.request:
         args += ' id="%s"' % self.request.get('id')
         if self.request.get('to') is not None:
             args += ' from="%s"' % self.request.get('to')
         if self.request.get('from') is not None:
             args += ' to="%s"' % self.request.get('from')
     if self.tagname is None:
         return u'<iq %s/>' % args
     return u'<iq %s>%s</iq>' % (args, Element.__unicode__(self))
Beispiel #3
0
 def __unicode__(self):
     """
     Convert the element into an XML unicode string.
     """
     args = 'type="error"'
     request = ''
     if self.request:
         args += ' id="%s"' % self.request.get('id')
         if self.request.get('to') is not None:
             args += ' from="%s"' % self.request.get('to')
         if self.request.get('from') is not None:
             args += ' to="%s"' % self.request.get('from')
         for child in self.request:
             request = unicode(child)
     return u'<iq %s>%s%s</iq>' % (args, request, Element.__unicode__(self))
Beispiel #4
0
 def __unicode__(self):
     """
     Convert the element into an XML unicode string.
     """
     return u'<message%s>%s</message>' % (self._routing, Element.__unicode__(self))
Beispiel #5
0
 def __unicode__(self):
     """
     Convert the element into an XML unicode string.
     """
     return u'<iq%s%s>%s</iq>' % (self._routing, self._attributes, Element.__unicode__(self))