diff --git a/smile_redis_session_store/README.rst b/smile_redis_session_store/README.rst index 6b6264fb4..6129bd3c6 100644 --- a/smile_redis_session_store/README.rst +++ b/smile_redis_session_store/README.rst @@ -25,14 +25,14 @@ You need to install package `redis`:: pip install redis -.. _`Redis website`: http://redis.io/topics/quickstart +.. _`Redis website`: http://redis.io/topics/quickstart Usage ===== To use Redis, install this module and please add `enable_redis = True` option -in configuration file. +in configuration file. Available options ----------------- @@ -41,7 +41,9 @@ Available options * `redis_port` (default: 6379): Redis port * `redis_dbindex` (default: 1): Redis database index * `redis_pass` (default: None): Redis password +* `redis_socket` (default: None) : unix socket path +If `redis_socket` is used, both `redis_host` and `redis_port` should be None. Bug Tracker =========== @@ -79,4 +81,4 @@ Since 1991 Smile has been a pioneer of technology and also the European expert i This module is part of the `odoo-addons `_ project on GitHub. -You are welcome to contribute. \ No newline at end of file +You are welcome to contribute. diff --git a/smile_redis_session_store/redis_session_store.py b/smile_redis_session_store/redis_session_store.py index ce84e621b..ba233e689 100644 --- a/smile_redis_session_store/redis_session_store.py +++ b/smile_redis_session_store/redis_session_store.py @@ -48,10 +48,16 @@ def __init__(self, *args, **kwargs): super(RedisSessionStore, self).__init__(*args, **kwargs) self.expire = kwargs.get('expire', SESSION_TIMEOUT) self.key_prefix = kwargs.get('key_prefix', '') + _port = tools.config.get('redis_port', 6379) + try: + _port = int(_port) + except ValueError: + _port = None self.redis = redis.Redis(host=tools.config.get('redis_host', 'localhost'), - port=int(tools.config.get('redis_port', 6379)), + port=_port, db=int(tools.config.get('redis_dbindex', 1)), - password=tools.config.get('redis_pass', None)) + password=tools.config.get('redis_pass', None), + unix_socket_path=tools.config.get('redis_socket', None)) self._is_redis_server_running() def save(self, session): diff --git a/smile_redis_session_store/static/description/index.html b/smile_redis_session_store/static/description/index.html index 612e13177..b7468409f 100644 --- a/smile_redis_session_store/static/description/index.html +++ b/smile_redis_session_store/static/description/index.html @@ -3,13 +3,13 @@ - + Redis Session Store