diff options
author | Roberto Soares <roberto.tech@gmail.com> | 2015-04-09 15:58:22 -0300 |
---|---|---|
committer | Roberto Soares <roberto.tech@gmail.com> | 2015-04-09 15:59:38 -0300 |
commit | e5b4ca353863a600a8d6151090b83f3210720a47 (patch) | |
tree | dc815c1e397362be7d5cfe7d5536951000292f07 /service/pixelated/resources | |
parent | beac9142c2766ed8daf7dd13b6ba22b7895402a5 (diff) |
listening event 'recoverMany'
Diffstat (limited to 'service/pixelated/resources')
-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)) |