fix a test in python3

This commit is contained in:
Arthur Vuillard
2017-05-11 18:19:33 +02:00
parent 67729a8f30
commit 4d109a6857
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from django.utils.encoding import (
python_2_unicode_compatible, smart_bytes, smart_text)
python_2_unicode_compatible, smart_bytes, smart_text, force_str)
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _, ugettext_lazy
@@ -154,7 +154,7 @@ class User(PermissionsMixin):
match = self.password_expr.match(self.password)
if match is None:
return False
raw_value = smart_bytes(raw_value)
raw_value = force_str(raw_value)
scheme = match.group(1)
val2 = match.group(2)
hasher = get_password_hasher(scheme)
@@ -425,6 +425,7 @@ class User(PermissionsMixin):
row += result[1]
csvwriter.writerow(row)
reversion.register(User)
+2 -1
View File
@@ -13,6 +13,7 @@ from random import Random
import string
from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_text
class PasswordHasher(object):
@@ -35,7 +36,7 @@ class PasswordHasher(object):
"""
if self._target == 'ldap':
return base64.b64encode(pwhash)
return pwhash
return force_text(pwhash)
def encrypt(self, clearvalue):
"""Encrypt a password.