changeset 068a70e75ca7 in modules/web_shortener:default
details: 
https://hg.tryton.org/modules/web_shortener?cmd=changeset;node=068a70e75ca7
description:
        Add __href__ and is_secure, host and http_host to url module

        This ease the composition of URL pointing to Tryton route.

        issue8767
        review264461005
diffstat:

 web.py |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (29 lines):

diff -r e5fa76bc077c -r 068a70e75ca7 web.py
--- a/web.py    Mon Nov 25 21:55:22 2019 +0100
+++ b/web.py    Tue Nov 26 22:16:00 2019 +0100
@@ -3,7 +3,7 @@
 
 import string
 import logging
-from urllib.parse import urlunsplit, urljoin, quote
+from urllib.parse import urljoin, quote
 
 from sql.aggregate import Count
 
@@ -12,14 +12,11 @@
 from trytond.pool import Pool
 from trytond.tools import grouped_slice, reduce_ids
 from trytond.transaction import Transaction
-from trytond.url import HOSTNAME
+from trytond.url import http_host
 from trytond.wsgi import Base64Converter
 
-USE_SSL = bool(config.get('ssl', 'certificate'))
 ALPHABET = string.digits + string.ascii_lowercase
-URL_BASE = config.get('web', 'shortener_base',
-    default=urlunsplit(
-        ('http' + ('s' if USE_SSL else ''), HOSTNAME, '', '', '')))
+URL_BASE = config.get('web', 'shortener_base', default=http_host())
 logger = logging.getLogger(__name__)
 
 

Reply via email to