summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-20 02:19:48 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-20 02:19:48 +0000
commit3db846cdb5ac8606ed66a8dce55f0644f6c1cce3 (patch)
tree9d06e3eacf40675e1e1a76db15ecf62b4b89df54
parent24588afe6d9f104bb0256136bafcf1d985e93eaf (diff)
Fixed #5548 -- Reintroduced Jython workaround for os.getpid(), which was lost in [6270]. Thanks, leosoto
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6386 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/sessions/backends/base.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py
index 382212bb70..ec057997b7 100644
--- a/django/contrib/sessions/backends/base.py
+++ b/django/contrib/sessions/backends/base.py
@@ -82,9 +82,14 @@ class SessionBase(object):
"Returns session key that isn't being used."
# The random module is seeded when this Apache child is created.
# Use settings.SECRET_KEY as added salt.
+ try:
+ pid = os.getpid()
+ except AttributeError:
+ # No getpid() in Jython, for example
+ pid = 1
while 1:
- session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1),
- os.getpid(), time.time(), settings.SECRET_KEY)).hexdigest()
+ session_key = md5.new("%s%s%s%s" % (random.randint(0, sys.maxint - 1),
+ pid, time.time(), settings.SECRET_KEY)).hexdigest()
if not self.exists(session_key):
break
return session_key