core (tools/common/uri): don't display finale "?" if no extra data is specified
This commit is contained in:
parent
97c3333418
commit
3c8a46760a
1 changed files with 6 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue