# HG changeset patch # User Goffi # Date 1495190403 -7200 # Node ID e5e54ff0b775a34661c889700c6891198c2a14d2 # Parent f87b673c7d17c1c84e0b74fef9335365ad502d4a core (tools/common/uri): don't display finale "?" if no extra data is specified diff -r f87b673c7d17 -r e5e54ff0b775 src/tools/common/uri.py --- a/src/tools/common/uri.py Fri May 19 12:37:54 2017 +0200 +++ b/src/tools/common/uri.py Fri May 19 12:40:03 2017 +0200 @@ -77,18 +77,19 @@ 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)