diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-05 14:34:49 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:32 +0200 |
commit | 3dfec58b96876514a41abf916f280694f30bb8cd (patch) | |
tree | fca92479a77713028ad1b6707879f25306b8798f /service/pixelated/adapter | |
parent | d2e5af008d012c24716c6515490ea4639b8dd9a1 (diff) |
Assert return value for add_mail and that a LeapMail instance is passed to search engine.
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r-- | service/pixelated/adapter/mailstore/searchable_mailstore.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/service/pixelated/adapter/mailstore/searchable_mailstore.py b/service/pixelated/adapter/mailstore/searchable_mailstore.py index ad5fca33..1db34fd9 100644 --- a/service/pixelated/adapter/mailstore/searchable_mailstore.py +++ b/service/pixelated/adapter/mailstore/searchable_mailstore.py @@ -13,6 +13,7 @@ # # 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 twisted.internet import defer from pixelated.adapter.mailstore.mailstore import MailStore @@ -22,6 +23,8 @@ class SearchableMailStore(MailStore): self._delegate = delegate self._search_engine = search_engine + @defer.inlineCallbacks def add_mail(self, mailbox_name, mail): - self._delegate.add_mail(mailbox_name, mail) - self._search_engine.index_mail(mail) + stored_mail = yield self._delegate.add_mail(mailbox_name, mail) + self._search_engine.index_mail(stored_mail) + defer.returnValue(stored_mail) |