]> git.parisson.com Git - django-social-auth.git/commitdiff
Replaced deprecated md5 import, Refs gh-7
authorMatías Aguirre <matiasaguirre@gmail.com>
Wed, 5 Jan 2011 15:08:43 +0000 (13:08 -0200)
committerMatías Aguirre <matiasaguirre@gmail.com>
Wed, 5 Jan 2011 15:09:32 +0000 (13:09 -0200)
social_auth/backends.py

index ee5ce5a361f308440746d0d540fbe4a798316cde..374ffe37715408078433e76d715c1d4b30a8b36a 100644 (file)
@@ -1,8 +1,9 @@
 """
 Authentication backeds for django.contrib.auth AUTHENTICATION_BACKENDS setting
 """
-import os
-import md5
+from os import urandom
+from hashlib import md5
+
 from openid.extensions import ax, sreg
 
 from django.conf import settings
@@ -66,7 +67,7 @@ class SocialAuthBackend(ModelBackend):
         """
         def get_random_username():
             """Return hash from random string cut at 30 chars"""
-            return md5.md5(str(os.urandom(10))).hexdigest()[:30]
+            return md5(str(urandom(10))).hexdigest()[:30]
 
         if getattr(settings, 'SOCIAL_AUTH_FORCE_RANDOM_USERNAME', False):
             username = get_random_username()