trytond-patches/client-open_url.diff
2014-05-25 08:02:29 +02:00

21 lines
958 B
Diff

diff -r 072562663a50 tryton/gui/main.py
--- ./tryton/tryton/gui/main.py Fri May 09 10:13:53 2014 +0200
+++ ./tryton/tryton/gui/main.py Sat May 24 18:14:02 2014 +0200
@@ -1420,10 +1420,12 @@
if not urlp.scheme == 'tryton':
return
urlp = urlparse('http' + url[6:])
- hostname, port = map(urllib.unquote,
- (urlp.netloc.split(':', 1) + [CONFIG.defaults['login.port']])[:2])
- database, path = map(urllib.unquote,
- (urlp.path[1:].split('/', 1) + [None])[:2])
+ hostname = urllib.unquote(urlp.hostname or
+ CONFIG.defaults['login.server'])
+ port = urlp.port or str(CONFIG.defaults['login.port'])
+ path = urlp.path[1:].split('/', 1)
+ database = urllib.unquote(path.pop(0))
+ path = path and urllib.unquote(path[0]) or ""
if (not path or
hostname != rpc._HOST or
int(port) != rpc._PORT or
)