Ticket #5548: os_pid_again.patch
File os_pid_again.patch, 1.0 KB (added by , 17 years ago) |
---|
-
django/contrib/sessions/backends/base.py
82 82 "Returns session key that isn't being used." 83 83 # The random module is seeded when this Apache child is created. 84 84 # Use settings.SECRET_KEY as added salt. 85 try: 86 pid = os.getpid() 87 except AttributeError: 88 # No getpid() in Jython, for example 89 pid = 1 85 90 while 1: 86 session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1), 87 os.getpid(), time.time(), settings.SECRET_KEY)).hexdigest()91 session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1), 92 pid, time.time(), settings.SECRET_KEY)).hexdigest() 88 93 if not self.exists(session_key): 89 94 break 90 95 return session_key