Ticket #5548: os_pid_again.patch

File os_pid_again.patch, 1.0 KB (added by leosoto <leo.soto@…>, 17 years ago)

patch

  • django/contrib/sessions/backends/base.py

     
    8282        "Returns session key that isn't being used."
    8383        # The random module is seeded when this Apache child is created.
    8484        # 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
    8590        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()
    8893            if not self.exists(session_key):
    8994                break
    9095        return session_key
Back to Top