diff --git a/src/tools/common/uri.py b/src/tools/common/uri.py index 185f11e2..f1951c44 100644 --- a/src/tools/common/uri.py +++ b/src/tools/common/uri.py @@ -77,18 +77,19 @@ def addPairs(uri, pairs): for k,v in pairs.iteritems(): uri.append(u';' + urllib.quote_plus(k) + u'=' + urllib.quote_plus(v)) -def buildXMPPUri(type, **kwargs): +def buildXMPPUri(type_, **kwargs): uri = [u'xmpp:'] subtype = kwargs.pop('subtype', None) path = kwargs.pop('path') uri.append(urllib.quote_plus(path).replace(u'%40', '@')) - if type == u'pubsub': + if type_ == u'pubsub': if subtype == 'microblog' and not 'node' in kwargs: kwargs[u'node'] = 'urn:xmpp:microblog:0' - uri.append(u'?') - addPairs(uri, kwargs) + if kwargs: + uri.append(u'?') + addPairs(uri, kwargs) else: - raise NotImplementedError(u'{type} URI are not handled yet'.format(type=type)) + raise NotImplementedError(u'{type_} URI are not handled yet'.format(type_=type_)) return u''.join(uri)