From: Guillaume Pellerin Date: Thu, 23 Nov 2023 08:12:21 +0000 (+0100) Subject: except for urrlib X-Git-Tag: 2.8.1-ae~9 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9794fb438a241b825b01dabbf5daa868439cd3dc;p=teleforma.git except for urrlib --- diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index ff1e2b4b..ee6a1cee 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -280,11 +280,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