From b53fc14234017cc9275bc319e4e4866f1ef9c142 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 14 Jul 2015 22:47:27 +0200 Subject: attachment now supports deferred --- service/pixelated/adapter/soledad/soledad_reader_mixin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'service/pixelated/adapter/soledad') diff --git a/service/pixelated/adapter/soledad/soledad_reader_mixin.py b/service/pixelated/adapter/soledad/soledad_reader_mixin.py index fc673726..b365da7e 100644 --- a/service/pixelated/adapter/soledad/soledad_reader_mixin.py +++ b/service/pixelated/adapter/soledad/soledad_reader_mixin.py @@ -75,10 +75,11 @@ class SoledadReaderMixin(SoledadDbFacadeMixin, object): fdocs_chash = [(result, ident) for result, ident in fdocs_chash if result] return self._build_mails_from_fdocs(fdocs_chash) + @defer.inlineCallbacks def attachment(self, attachment_ident, encoding): - bdoc = self.get_content_by_phash(attachment_ident) - return {'content': self._try_decode(bdoc.content['raw'], encoding), - 'content-type': bdoc.content['content-type']} + bdoc = yield self.get_content_by_phash(attachment_ident) + defer.returnValue({'content': self._try_decode(bdoc.content['raw'], encoding), + 'content-type': bdoc.content['content-type']}) def _try_decode(self, raw, encoding): encoding = encoding.lower() -- cgit v1.2.3