diff options
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/resources/mails_resource.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/service/pixelated/resources/mails_resource.py b/service/pixelated/resources/mails_resource.py index c057031a..bb9297f2 100644 --- a/service/pixelated/resources/mails_resource.py +++ b/service/pixelated/resources/mails_resource.py @@ -52,6 +52,19 @@ class MailsDeleteResource(Resource): self._mail_service.delete_mail(ident) return respond_json(None, request) +class MailsRecoverResource(Resource): + isLeaf = True + + def __init__(self, mail_service): + Resource.__init__(self) + self._mail_service = mail_service + + def render_POST(self, request): + idents = json.loads(request.content.read())['idents'] + for ident in idents: + self._mail_service.recover_mail(ident) + return respond_json(None, request) + class MailsResource(Resource): @@ -66,6 +79,7 @@ class MailsResource(Resource): def __init__(self, mail_service, draft_service): Resource.__init__(self) self.putChild('delete', MailsDeleteResource(mail_service)) + self.putChild('recover', MailsRecoverResource(mail_service)) self.putChild('read', MailsReadResource(mail_service)) self.putChild('unread', MailsUnreadResource(mail_service)) |