diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py index cc823c537e..9f4bf6f487 100644 --- a/django/contrib/sessions/backends/base.py +++ b/django/contrib/sessions/backends/base.py @@ -15,9 +15,9 @@ from django.utils.hashcompat import md5_constructor # Use the system (hardware-based) random number generator if it exists. if hasattr(random, 'SystemRandom'): - randint = random.SystemRandom().randint + randrange = random.SystemRandom().randrange else: - randint = random.randint + randrange = random.randrange MAX_SESSION_KEY = 18446744073709551616L # 2 << 63 class CreateError(Exception): @@ -135,7 +135,7 @@ class SessionBase(object): pid = 1 while 1: session_key = md5_constructor("%s%s%s%s" - % (random.randrange(0, MAX_SESSION_KEY), pid, time.time(), + % (randrange(0, MAX_SESSION_KEY), pid, time.time(), settings.SECRET_KEY)).hexdigest() if not self.exists(session_key): break