From: Guillaume Pellerin Date: Wed, 23 Jun 2021 12:48:22 +0000 (+0200) Subject: bugfix get_host X-Git-Tag: 2.1~66^2^2~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=72e0fda59e77fd5410168dc91fa04ed3390ec384;p=teleforma.git bugfix get_host --- diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index 63219c6b..8b4420c9 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -275,11 +275,14 @@ def get_video_id(media): @register.filter def get_host(url, host): - u = urlparse(url) - if host == '127.0.0.1' or host == 'localhost': - nu = u.scheme + '://' + host + ':' + str(u.port) + u.path - return nu - else: + try: + #TODO adapt to urllib py3 + # https://stackoverflow.com/questions/12772190/urllib-module-object-is-not-callable + u = urlparse(url) + if host == '127.0.0.1' or host == 'localhost': + nu = u.scheme + '://' + host + ':' + str(u.port) + u.path + return nu + except: return url