Reviewers: ,


Please review this at http://codereview.tryton.org/597003/

Affected files:
  M trytond/url.py


Index: trytond/url.py
===================================================================
--- a/trytond/url.py
+++ b/trytond/url.py
@@ -10,6 +10,11 @@

 __all__ = ['URLMixin']

+HOSTNAME = (CONFIG['hostname_jsonrpc']
+    or unicode(socket.getfqdn(), 'utf8'))
+HOSTNAME = '.'.join(encodings.idna.ToASCII(part) for part in
+    HOSTNAME.split('.'))
+

 class URLAccessor(object):

@@ -18,11 +23,6 @@
         from trytond.wizard import Wizard
         from trytond.report import Report

-        hostname = (CONFIG['hostname_jsonrpc']
-            or unicode(socket.getfqdn(), 'utf8'))
-        hostname = '.'.join(encodings.idna.ToASCII(part) for part in
-            hostname.split('.'))
-
         url_part = {}
         if issubclass(cls, Model):
             url_part['type'] = 'model'
@@ -39,7 +39,7 @@
local_part = urllib.quote('%(database)s/%(type)s/%(name)s' % url_part)
         if isinstance(inst, Model) and inst.id:
             local_part += '/%d' % inst.id
-        return 'tryton://%s/%s' % (hostname, local_part)
+        return 'tryton://%s/%s' % (HOSTNAME, local_part)


 class URLMixin(object):


--
--
[email protected] mailing list



Reply via email to