Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

change to accept being passed an memcache object, such as a MemcacheP…

…ool to manage connections better
  • Loading branch information...
commit 05d611ef11cdb1bf6ad750cbd29eee15ac244e57 1 parent 7ea154d
Joseph Bowman authored

Showing 1 changed file with 9 additions and 2 deletions. Show diff stats Hide diff stats

  1. +9 2 sessions/__init__.py
11 sessions/__init__.py
@@ -28,14 +28,21 @@ def __init__(self, cookie_path=settings.session["DEFAULT_COOKIE_PATH"],
28 28 session_token_ttl=settings.session["SESSION_TOKEN_TTL"],
29 29 session_expire_time=settings.session["SESSION_EXPIRE_TIME"],
30 30 memcache_url=settings.session["MEMCACHE_URL"],
31   - req_obj = False):
  31 + req_obj = False,
  32 + mc = None):
32 33 """
33 34 __init__ loads the session, checking the browser for a valid session
34 35 token. It will either validate the session and/or create a new one
35 36 if necessary.
36 37 """
37 38
38   - self.mc = memcache.Client(memcache_url, debug=0)
  39 + # accept being passed a memcache object, which can be
  40 + # a MemcachePool, as found here
  41 + # http://jehiah.cz/download/MemcachePool.py.txt
  42 + if mc is None:
  43 + self.mc = memcache.Client(memcache_url, debug=0)
  44 + else:
  45 + self.mc = mc
39 46
40 47 # If session is being used on this page view, then go ahead
41 48 # and make the page not cacheable. This makes sure the user

0 comments on commit 05d611e

Please sign in to comment.
Something went wrong with that request. Please try again.