Fixed indentation in StanzaBase.

This commit is contained in:
Lance Stout 2010-08-26 14:19:36 -04:00
parent 5c59f5baca
commit 56766508b3

View file

@ -881,7 +881,8 @@ class StanzaBase(ElementBase):
types = set(('get', 'set', 'error', None, 'unavailable', 'normal', 'chat'))
sub_interfaces = tuple()
def __init__(self, stream=None, xml=None, stype=None, sto=None, sfrom=None, sid=None):
def __init__(self, stream=None, xml=None, stype=None,
sto=None, sfrom=None, sid=None):
self.stream = stream
if stream is not None:
self.namespace = stream.default_ns
@ -919,7 +920,8 @@ class StanzaBase(ElementBase):
def reply(self):
# if it's a component, use from
if self.stream and hasattr(self.stream, "is_component") and self.stream.is_component:
if self.stream and hasattr(self.stream, "is_component") and \
self.stream.is_component:
self['from'], self['to'] = self['to'], self['from']
else:
self['to'] = self['from']
@ -947,7 +949,8 @@ class StanzaBase(ElementBase):
pass
def exception(self, e):
logging.exception('Error handling {%s}%s stanza' % (self.namespace, self.name))
logging.exception('Error handling {%s}%s stanza' % (self.namespace,
self.name))
def send(self):
self.stream.sendRaw(self.__str__())
@ -956,4 +959,6 @@ class StanzaBase(ElementBase):
return self.__class__(xml=copy.deepcopy(self.xml), stream=self.stream)
def __str__(self):
return tostring(self.xml, xmlns='', stanza_ns=self.namespace, stream=self.stream)
return tostring(self.xml, xmlns='',
stanza_ns=self.namespace,
stream=self.stream)