Skip to content
This repository was archived by the owner on Dec 28, 2017. It is now read-only.

Commit c473119

Browse files
author
Greg Taylor
committed
Merge branch 'master' of github.com:gtaylor/django-dynamodb-sessions
2 parents e8fd4c3 + 76728de commit c473119

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

dynamodb_sessions/backends/dynamodb.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import os
21
import time
32
import logging
43

54
import boto
65
from django.conf import settings
7-
from django.contrib.sessions.backends.base import SessionBase, CreateError, randrange, MAX_SESSION_KEY
6+
from django.contrib.sessions.backends.base import SessionBase, CreateError
87
from django.utils.hashcompat import md5_constructor
98
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
109
from boto.exception import DynamoDBResponseError
@@ -57,24 +56,6 @@ def __init__(self, session_key=None):
5756
super(SessionStore, self).__init__(session_key)
5857
self.table = dynamodb_connection_factory().get_table(TABLE_NAME)
5958

60-
def _get_new_session_key(self):
61-
"""
62-
Returns session key.
63-
"""
64-
# The random module is seeded when this Apache child is created.
65-
# Use settings.SECRET_KEY as added salt.
66-
try:
67-
pid = os.getpid()
68-
except AttributeError:
69-
# No getpid() in Jython, for example
70-
pid = 1
71-
72-
# Unlike the method this overrides, assume that the hash is good
73-
# to use. save(must_create=True) will make sure that this is
74-
# unique.
75-
return md5_constructor("%s%s%s%s"
76-
% (randrange(0, MAX_SESSION_KEY), pid, time.time(),
77-
settings.SECRET_KEY)).hexdigest()
7859

7960
def load(self):
8061
"""

0 commit comments

Comments
 (0)