Skip to content

Commit

Permalink
[py2] Remove useless force_text method from django compat modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Vallet committed Oct 29, 2019
1 parent 3f16138 commit 2f30347
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions django_hosts/resolvers.py
Expand Up @@ -11,7 +11,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.urls import NoReverseMatch, reverse as reverse_path
from django.utils.encoding import iri_to_uri, force_text
from django.utils.encoding import iri_to_uri
from django.utils.functional import lazy
from django.utils.lru_cache import lru_cache
from django.utils.regex_helper import normalize
Expand Down Expand Up @@ -101,19 +101,15 @@ def reverse_host(host, args=None, kwargs=None):
if not isinstance(host, host_cls):
host = get_host(host)

unicode_args = [force_text(x) for x in args]
unicode_kwargs = dict(((k, force_text(v))
for (k, v) in kwargs.items()))

for result, params in normalize(host.regex):
if args:
if len(args) != len(params):
continue
candidate = result % dict(zip(params, unicode_args))
candidate = result % dict(zip(params, args))
else:
if set(kwargs.keys()) != set(params):
continue
candidate = result % unicode_kwargs
candidate = result % kwargs

if re.match(host.regex, candidate, re.UNICODE): # pragma: no cover
parent_host = getattr(settings, 'PARENT_HOST', '').lstrip('.')
Expand Down

0 comments on commit 2f30347

Please sign in to comment.