Commits

Alen Mujezinovic  committed 3ad8000

Updated to work with Python 2.6 without deprecation warnings

  • Participants
  • Parent commits d073602
  • Tags v0.7.1

Comments (0)

Files changed (1)

File registration/models.py

 import datetime
 import random
 import re
-import sha
+try:
+    from hashlib import sha1 as sha
+except ImportError:
+    from sha import new as sha 
 
 from django.conf import settings
 from django.db import models
         username and a random salt.
         
         """
-        salt = sha.new(str(random.random())).hexdigest()[:5]
-        activation_key = sha.new(salt+user.username).hexdigest()
+        salt = sha(str(random.random())).hexdigest()[:5]
+        activation_key = sha(salt + user.username).hexdigest()
         return self.create(user=user,
                            activation_key=activation_key)