Browse files

hashlib is another 2.5 dependency

  • Loading branch information...
1 parent 936ed70 commit 60d7984c897f042d7f3a055e07a3f37693291cd7 @jamesturk jamesturk committed Jan 23, 2009
Showing with 5 additions and 2 deletions.
  1. +5 −2 secretballot/middleware.py
View
7 secretballot/middleware.py
@@ -1,4 +1,7 @@
-import hashlib
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
class SecretBallotMiddleware(object):
def process_request(self, request):
@@ -15,4 +18,4 @@ def generate_token(self, request):
class SecretBallotIpUseragentMiddleware(SecretBallotMiddleware):
def generate_token(self, request):
s = ''.join((request.META['REMOTE_ADDR'], request.META['HTTP_USER_AGENT']))
- return hashlib.md5(s).hexdigest()
+ return md5(s).hexdigest()

0 comments on commit 60d7984

Please sign in to comment.