diff options
author | pjrharley <devnull@localhost> | 2009-05-23 21:13:53 +0100 |
---|---|---|
committer | pjrharley <devnull@localhost> | 2009-05-23 21:13:53 +0100 |
commit | 18e080418f3b2f29c431d081d43bc5f5bc2846c4 (patch) | |
tree | 8e56c49ce8d0ba2bf5742452f0641be5036f13ce | |
parent | 4ba77b9c2fc45cb9f8780de89eaa137d95513e54 (diff) | |
download | troggle-18e080418f3b2f29c431d081d43bc5f5bc2846c4.tar.gz troggle-18e080418f3b2f29c431d081d43bc5f5bc2846c4.tar.bz2 troggle-18e080418f3b2f29c431d081d43bc5f5bc2846c4.zip |
[svn] Use the django compatability thing - webserver might have old python on it....
-rw-r--r-- | registration/models.py | 6 | ||||
-rw-r--r-- | registration/tests.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/registration/models.py b/registration/models.py index 3a28095..cf0561b 100644 --- a/registration/models.py +++ b/registration/models.py @@ -1,7 +1,7 @@ import datetime import random import re -import hashlib +from django.utils.hashcompat import sha_constructor from django.conf import settings from django.contrib.auth.models import User @@ -152,8 +152,8 @@ class RegistrationManager(models.Manager): username and a random salt. """ - salt = hashlib.sha1(str(random.random())).hexdigest()[:5] - activation_key = hashlib.sha1(salt+user.username).hexdigest() + salt = sha_constructor(str(random.random())).hexdigest()[:5] + activation_key = sha_constructor(salt+user.username).hexdigest() return self.create(user=user, activation_key=activation_key) diff --git a/registration/tests.py b/registration/tests.py index 9b1ea5e..df6bb2d 100644 --- a/registration/tests.py +++ b/registration/tests.py @@ -20,7 +20,7 @@ getting django-registration running in the default setup, to wit: """ import datetime -import hashlib +from django.utils.hashcompat import sha_constructor from django.conf import settings from django.contrib.auth.models import User @@ -115,7 +115,7 @@ class RegistrationModelTests(RegistrationTestCase): self.failIf(RegistrationProfile.objects.activate_user('foo')) # Activating from a key that doesn't exist returns False. - self.failIf(RegistrationProfile.objects.activate_user(hashlib.sha1('foo').hexdigest())) + self.failIf(RegistrationProfile.objects.activate_user(sha_constructor('foo').hexdigest())) def test_account_expiration_condition(self): """ @@ -351,5 +351,5 @@ class RegistrationViewTests(RegistrationTestCase): # Nonexistent key sets the account to False. response = self.client.get(reverse('registration_activate', - kwargs={ 'activation_key': hashlib.sha1('foo').hexdigest() })) + kwargs={ 'activation_key': sha_constructor('foo').hexdigest() })) self.failIf(response.context['account']) |