Skip to content

Commit

Permalink
change to accept being passed an memcache object, such as a MemcacheP…
Browse files Browse the repository at this point in the history
…ool to manage connections better
  • Loading branch information
joerussbowman committed May 31, 2010
1 parent 7ea154d commit 05d611e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sessions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ def __init__(self, cookie_path=settings.session["DEFAULT_COOKIE_PATH"],
session_token_ttl=settings.session["SESSION_TOKEN_TTL"],
session_expire_time=settings.session["SESSION_EXPIRE_TIME"],
memcache_url=settings.session["MEMCACHE_URL"],
req_obj = False):
req_obj = False,
mc = None):
"""
__init__ loads the session, checking the browser for a valid session
token. It will either validate the session and/or create a new one
if necessary.
"""

self.mc = memcache.Client(memcache_url, debug=0)
# accept being passed a memcache object, which can be
# a MemcachePool, as found here
# http://jehiah.cz/download/MemcachePool.py.txt
if mc is None:
self.mc = memcache.Client(memcache_url, debug=0)
else:
self.mc = mc

# If session is being used on this page view, then go ahead
# and make the page not cacheable. This makes sure the user
Expand Down

0 comments on commit 05d611e

Please sign in to comment.