diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-18 11:36:42 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2016-01-18 11:36:42 +0100 |
commit | 6f2ee1d6a7637fae8aaa34c59e507f247e2f5201 (patch) | |
tree | 435cae51d6e181d43613517b894ea2ada6076c2b /service/pixelated | |
parent | 2759ed4246d215ca4618ab97537815d262677723 (diff) |
Move user folder logic up to Services
- Issue #576
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/search/__init__.py | 4 | ||||
-rw-r--r-- | service/pixelated/config/services.py | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py index 27563c03..dbd4d288 100644 --- a/service/pixelated/adapter/search/__init__.py +++ b/service/pixelated/adapter/search/__init__.py @@ -36,9 +36,9 @@ class SearchEngine(object): DEFAULT_INDEX_HOME = os.path.join(os.environ['HOME'], '.leap') DEFAULT_TAGS = ['inbox', 'sent', 'drafts', 'trash'] - def __init__(self, key, namespace, agent_home=DEFAULT_INDEX_HOME): + def __init__(self, key, user_home=DEFAULT_INDEX_HOME): self.key = key - self.index_folder = os.path.join(agent_home, 'search_index', namespace) + self.index_folder = os.path.join(user_home, 'search_index') if not os.path.exists(self.index_folder): os.makedirs(self.index_folder) self._index = self._create_index() diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py index a55fdfa3..1d5d951a 100644 --- a/service/pixelated/config/services.py +++ b/service/pixelated/config/services.py @@ -1,3 +1,4 @@ +import os import logging from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore @@ -54,7 +55,9 @@ class Services(object): key_unicode = yield search_index_storage_key.get_or_create_key() key = str(key_unicode) logger.debug('The key len is: %s' % len(key)) - search_engine = SearchEngine(key, namespace, agent_home=self._leap_home) + user_id = self._leap_session.user_auth.uuid + user_folder = os.path.join(self._leap_home, user_id) + search_engine = SearchEngine(key, user_home=user_folder) self.search_engine = search_engine def _setup_mail_service(self, search_engine): |