diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-07-14 22:47:27 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:23 +0200 |
commit | b53fc14234017cc9275bc319e4e4866f1ef9c142 (patch) | |
tree | d034661dbc8777769950ae387f8e6e84799890a7 | |
parent | 20a5aaaa20950fee1627edbffed3f87e6613a0cf (diff) |
attachment now supports deferred
-rw-r--r-- | service/pixelated/adapter/soledad/soledad_reader_mixin.py | 7 |
1 files changed, 4 insertions, 3 deletions
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() |