Micro-optimise _format_jid.

This commit is contained in:
Emmanuel Gil Peyrot 2016-08-21 20:26:51 +01:00
parent 39ee833c29
commit e28318c271

View File

@ -208,16 +208,15 @@ def _format_jid(local=None, domain=None, resource=None):
:return: A full or bare JID string. :return: A full or bare JID string.
""" """
result = [] if domain is None:
return ''
if local is not None: if local is not None:
result.append(local) result = local + '@' + domain
result.append('@') else:
if domain is not None: result = domain
result.append(domain)
if resource is not None: if resource is not None:
result.append('/') result += '/' + resource
result.append(resource) return result
return ''.join(result)
class InvalidJID(ValueError): class InvalidJID(ValueError):