예제 #1
0
 def __init__(self, key_template=config.SESSION_KEY, expire=config.SESSION_EXPIRE, \
         salt=config.SESSION_SALT, pool=None):
     SessionStore.__init__(self)
     self.redis = Redis(connection_pool=pool)
     self.key_template = key_template
     self.expire = expire
     self.salt = salt
예제 #2
0
파일: ninja.py 프로젝트: zinw/l2py
 def __init__(self,
              session_class=None,
              servers=None,
              default_timeout=600,
              key_prefix=None):
     SessionStore.__init__(self, session_class)
     self.mc = MemcachedCache(servers, default_timeout, key_prefix)
예제 #3
0
    def __init__(self, session_class=None):
        self.COOKIE_NAME = "sessionfast"
        SessionStore.__init__(self, session_class=None)
        self.sessions = {}

        # Number of minutes before sessions expire
        self.expire = 40
예제 #4
0
 def __init__(self, servers, session_class=Session):
     SessionStore.__init__(self, session_class)
     try:
         import cmemcache as memcache
     except ImportError:
         import memcache
     self.client = memcache.Client(servers)
예제 #5
0
 def __init__(self, file_path=None, session_class=Session):
     import bsddb
     SessionStore.__init__(self, session_class)
     if file_path is None:
         from tempfile import gettempdir
         file_path = os.path.join(gettempdir(), 'session.bdb')
     self.db = bsddb.hashopen(file_path)
예제 #6
0
 def __init__(self, session_class=None, key_prefix=''):
     SessionStore.__init__(self, session_class=session_class)
     self.redis = redis.Redis(tools.config.get('redis_host', 'localhost'),
                              int(tools.config.get('redis_port', 6379)),
                              int(tools.config.get('redis_dbindex', 1)),
                              password=tools.config.get('redis_pass', None))
     self.path = openerp.tools.config.session_dir
     self.expire = int(tools.config.get('redis_session_expire', 1800))
     self.key_prefix = key_prefix
예제 #7
0
    def __init__(self, redis, key_template='session:%s', generate_salt=None):

        if not generate_salt:
            from users import get_config
            generate_salt = get_config().users_secret

        SessionStore.__init__(self)
        self.redis = redis
        self.key_template = key_template
        self.generate_salt = generate_salt
예제 #8
0
    def __init__(self, session_class=None, collection=None):
        SessionStore.__init__(self, session_class)

        if not collection:
            raise ValueError('collection can not be None')

        self.collection = db[collection]

        # Empty session collection
        self.collection.remove()
예제 #9
0
 def __init__(self, session_class=None, host=None, port=None, replicaset=None, db=None, collection=None):
     SessionStore.__init__(self, session_class)
     self.host = host
     self.port = port
     self.replicaset = replicaset
     self.db_name = db
     self.collection_name = collection
     self.db = None
     self.collection = None
     self.client = None
     self.mongo_init()
예제 #10
0
 def __init__(self, path=None, filename_template='werkzeug_%s.sess',
              session_class=None, renew_missing=False, mode=0644):
     SessionStore.__init__(self, session_class)
     if path is None:
         path = tempfile.gettempdir()
     self.path = path
     if isinstance(filename_template, unicode):
         filename_template = filename_template.encode(
             sys.getfilesystemencoding() or 'utf-8')
     assert not filename_template.endswith(_fs_transaction_suffix), \
         'filename templates may not end with %s' % _fs_transaction_suffix
     self.filename_template = filename_template
     self.renew_missing = renew_missing
     self.mode = mode
예제 #11
0
 def __init__(self,
              path=None,
              filename_template='werkzeug_%s.sess',
              session_class=None,
              renew_missing=False,
              mode=0644):
     SessionStore.__init__(self, session_class)
     if path is None:
         path = tempfile.gettempdir()
     self.path = path
     if isinstance(filename_template, unicode):
         filename_template = filename_template.encode(
             sys.getfilesystemencoding() or 'utf-8')
     assert not filename_template.endswith(_fs_transaction_suffix), \
         'filename templates may not end with %s' % _fs_transaction_suffix
     self.filename_template = filename_template
     self.renew_missing = renew_missing
     self.mode = mode
예제 #12
0
 def __init__(self, app, session_cache_config=None, app_cache_config=None):
     SessionStore.__init__(self)
     # check if app cache config exists, otherwise use the same as cache_config
     if app_cache_config and not session_cache_config:
         self._app_cache_client = Cache(config=app_cache_config)
         self._session_cache_client = Cache(config=app_cache_config)
     elif app_cache_config and session_cache_config:
         self._app_cache_client = Cache(config=app_cache_config)
         self._session_cache_client = Cache(config=session_cache_config)
     elif not app_cache_config and session_cache_config:
         self._app_cache_client = Cache(config=session_cache_config)
         self._session_cache_client = Cache(config=session_cache_config)
     else:
         self._app_cache_client = self._session_cache_client = Cache()
     self._app_cache_client.init_app(app)
     #self._session_cache_client.init_app(app)
     # now set the app config to contain the cache
     app.config['_session_cache'] = self._session_cache_client
     app.config['_app_cache'] = self._app_cache_client
예제 #13
0
  def __init__(self, servers=None, key_prefix=None, default_timeout=300):
    SessionStore.__init__(self)


    if isinstance(servers, (list, tuple)):
      try:
        import cmemcache as memcache
        is_cmemcache = True
      except ImportError:
        try:
            import memcache 
            is_cmemcache = False
            is_pylibmc = False
        except ImprotError:
          try:
            import pylibmc as memcache
            is_cmemcache = False
            is_pylibmc = True
          except ImportError:
            raise RuntimeErorr(' no memcache module found ')

      if is_cmemcache:
        client = memcache.Client(map(str, servers))
        try:
          client.debuglog = lambda *a: None
        except Exception:
            pass
      else:
        if is_pylibmc:
            client = memcache.Client(servers, False)
        else:
            client = memcache.Client(servers, False, HIGHEST_PROTOCOL)
    else:
        client = servers

    self._memcache_client = client
    self._memcache_key_prefix = key_prefix
    self._memcache_timeout = default_timeout
예제 #14
0
 def __init__(self, session_class=None):
     if session_class is None:
         session_class = Session
     SessionStore.__init__(self, session_class)
     self.session_class = session_class
예제 #15
0
 def __init__(self, session_class=None):
     SessionStore.__init__(self, session_class=None)
     self.sessions = {}
예제 #16
0
 def __init__(self, session_class=Session):
     SessionStore.__init__(self, session_class)
예제 #17
0
파일: ninja.py 프로젝트: dingweihua/l2py
 def __init__(self, session_class=None, servers=None, default_timeout=600, key_prefix=None):
     SessionStore.__init__(self, session_class)
     self.mc = MemcachedCache(servers, default_timeout, key_prefix)
예제 #18
0
    def __init__(self, key_prefix=None, host='127.0.0.1', dbindex=1, expire=1800):
        SessionStore.__init__(self)
 
        self.redis = redis.StrictRedis.from_url(host)
        self.key_prefix = key_prefix
        self.expire = expire
예제 #19
0
 def __init__(self, session_class=None):
     SessionStore.__init__(self, session_class=None)
     self.sessions = {}
예제 #20
0
파일: sessions.py 프로젝트: uzayr/nereid
 def __init__(self, session_class=Session):
     SessionStore.__init__(self, session_class)
예제 #21
0
    def __init__(self, key_prefix=None, host='127.0.0.1', port=6379, dbindex=1, expire=1800):
        SessionStore.__init__(self)

        self.redis = redis.Redis(host,port,dbindex)
        self.key_prefix = key_prefix
        self.expire = expire
예제 #22
0
 def __init__(self, servers, session_class=Session):
     SessionStore.__init__(self, session_class)
     import memcache
     self.client = memcache.Client(servers)
예제 #23
0
 def __init__(self, session_class=Session):
     SessionStore.__init__(self, session_class)
     from google.appengine.api import memcache
     self.client = memcache
 def __init__(self):
     SessionStore.__init__(self, None)