Exemplo n.º 1
0
    def post(self):
        to_users = self.request.get('to_users')
        to_emails = self.request.get('to')
        subject = self.request.get('subject')
        body = self.request.get('body')

        mail = Mail()
        mail.is_active = False
        mail.subject = subject
        mail.body = body
        mail.to_users = to_users
        mail.to_emails = split_emails(to_emails)
        mail.put()

        self.response.out.write(mail.to_json('subject', 'is_deleted', 'is_active', 'is_starred'))
Exemplo n.º 2
0
    def post(self, key):
        mail = db.get(db.Key(key))

        to_users = self.request.get('to_users')
        to_emails = self.request.get('to')
        subject = self.request.get('subject')
        body = self.request.get('body')

        if not mail.is_active:
            mail.subject = subject
            mail.body = body
            mail.to_users = to_users
            mail.to_emails = split_emails(to_emails)
            mail.put()

        self.response.out.write(mail.to_json('subject', 'is_deleted', 'is_active', 'is_starred'))