diff options
Diffstat (limited to 'service/pixelated/controllers')
-rw-r--r-- | service/pixelated/controllers/__init__.py | 1 | ||||
-rw-r--r-- | service/pixelated/controllers/contacts_controller.py | 31 | ||||
-rw-r--r-- | service/pixelated/controllers/features_controller.py | 2 |
3 files changed, 33 insertions, 1 deletions
diff --git a/service/pixelated/controllers/__init__.py b/service/pixelated/controllers/__init__.py index e1c13515..33da02b8 100644 --- a/service/pixelated/controllers/__init__.py +++ b/service/pixelated/controllers/__init__.py @@ -37,3 +37,4 @@ from tags_controller import TagsController from features_controller import FeaturesController from sync_info_controller import SyncInfoController from attachments_controller import AttachmentsController +from contacts_controller import ContactsController diff --git a/service/pixelated/controllers/contacts_controller.py b/service/pixelated/controllers/contacts_controller.py new file mode 100644 index 00000000..f9b0628b --- /dev/null +++ b/service/pixelated/controllers/contacts_controller.py @@ -0,0 +1,31 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. + +from pixelated.controllers import respond_json_deferred +from twisted.internet.threads import deferToThread + + +class ContactsController: + + def __init__(self, search_engine): + self._search_engine = search_engine + + def contacts(self, request): + query = request.args.get('q', [''])[0] + d = deferToThread(lambda: self._search_engine.contacts(query)) + d.addCallback(lambda tags: respond_json_deferred(tags, request)) + + return d
\ No newline at end of file diff --git a/service/pixelated/controllers/features_controller.py b/service/pixelated/controllers/features_controller.py index 4d375683..f3fa9dff 100644 --- a/service/pixelated/controllers/features_controller.py +++ b/service/pixelated/controllers/features_controller.py @@ -19,7 +19,7 @@ import os class FeaturesController: - DISABLED_FEATURES = ['draftReply', 'signatureStatus', 'encryptionStatus', 'contacts'] + DISABLED_FEATURES = ['draftReply', 'signatureStatus', 'encryptionStatus'] def __init__(self): pass |