Ticket #5486: jython_no_pid.patch

File jython_no_pid.patch, 1.5 KB (added by leosoto <leo.soto@…>, 17 years ago)
  • django/core/mail.py

     
    5050    """
    5151    timeval = time.time()
    5252    utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
    53     pid = os.getpid()
     53    try:
     54        pid = os.getpid()
     55    except AttributeError:
     56        # At least on Jython there is no getpid()
     57        pid = 1
    5458    randint = random.randrange(100000)
    5559    if idstring is None:
    5660        idstring = ''
  • django/contrib/sessions/models.py

     
    1515        "Returns session key that isn't being used."
    1616        # The random module is seeded when this Apache child is created.
    1717        # Use SECRET_KEY as added salt.
     18        try:
     19            pid = os.getpid()
     20        except AttributeError:
     21            # At least on Jython there is no getpid()
     22            pid = 1
    1823        while 1:
    19             session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1), os.getpid(), time.time(), settings.SECRET_KEY)).hexdigest()
     24            session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1), pid, time.time(), settings.SECRET_KEY)).hexdigest()
    2025            try:
    2126                self.get(session_key=session_key)
    2227            except self.model.DoesNotExist:
Back to Top