From 8d62e433994e65484f97dd4f89b2e4279ce4b3dd Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Tue, 21 Jul 2015 15:12:41 +0000 Subject: Fixed test_mark_as_read_unread.py. --- service/pixelated/resources/mails_resource.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'service/pixelated/resources') diff --git a/service/pixelated/resources/mails_resource.py b/service/pixelated/resources/mails_resource.py index 0651a909..27232ffc 100644 --- a/service/pixelated/resources/mails_resource.py +++ b/service/pixelated/resources/mails_resource.py @@ -21,9 +21,15 @@ class MailsUnreadResource(Resource): def render_POST(self, request): idents = json.load(request.content).get('idents') + deferreds = [] for ident in idents: - self._mail_service.mark_as_unread(ident) - return respond_json(None, request) + deferreds.append(self._mail_service.mark_as_unread(ident)) + + d = defer.gatherResults(deferreds, consumeErrors=True) + d.addCallback(lambda _: respond_json_deferred(None, request)) + d.addErrback(lambda _: respond_json_deferred(None, request, status_code=500)) + + return NOT_DONE_YET class MailsReadResource(Resource): -- cgit v1.2.3