Skip to content

Commit

Permalink
Merge pull request #234 from sn1c/update_for_django_4
Browse files Browse the repository at this point in the history
Update for Django 4
  • Loading branch information
etianen authored Dec 8, 2021
2 parents b8c8111 + 047d68b commit 5be47f7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions django_python3_ldap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import binascii
import itertools

from django.utils.encoding import force_text
try:
from django.utils.encoding import force_str
except ImportError:
from django.utils.encoding import force_text as force_str

from django.utils.module_loading import import_string

from django_python3_ldap.conf import settings
Expand All @@ -27,8 +31,8 @@ def clean_ldap_name(name):
"""
return re.sub(
r'[^a-zA-Z0-9 _\-.@:*]',
lambda c: "\\" + force_text(binascii.hexlify(c.group(0).encode("latin-1", errors="ignore"))).upper(),
force_text(name),
lambda c: "\\" + force_str(binascii.hexlify(c.group(0).encode("latin-1", errors="ignore"))).upper(),
force_str(name),
)


Expand Down

0 comments on commit 5be47f7

Please sign in to comment.