Add __href__ and is_secure, host and http_host to url module

This ease the composition of URL pointing to Tryton route.

issue8767
review264461005
This commit is contained in:
Cédric Krier committed 2019-11-26 22:16:00 +01:00
1 parent c62db1ed61
commit 1a0861d376
1 file changed
+3 -6
+3 -6
View File
@@ -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.model import fields, ModelSQL, ModelView
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__)