Django

Code

Changeset 6270

Show
Ignore:
Timestamp:
09/15/07 04:51:41 (1 year ago)
Author:
mtredinnick
Message:

Fixed #5486 -- Worked around the lack of os.getpid() in Jython, whilst still using it for CPython. Patch from Leo Soto.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/sessions/models.py

    r5803 r6270  
    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            # No getpid() in Jython, for example 
     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) 
  • django/trunk/django/core/mail.py

    r5854 r6270  
    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        # Not getpid() in Jython, for example. 
     57        pid = 1 
    5458    randint = random.randrange(100000) 
    5559    if idstring is None: