Ejemplo n.º 1
0
 def post(self, notif_id):
     try:
         result_dict = {'status': 'success'}
         notif = Notifier.get_by_id(int(notif_id))
         phone_number = self.request.get('phone_number')
         name = self.request.get('name')
         email = self.request.get('email')
         phone_type = self.request.get('phoneType')
         recipient_id = self.request.get('recipient_id', '')
         if recipient_id != '':
             recipient = Recipient.get_by_id(int(recipient_id))
             recipient.phone_number = phone_number
             recipient.phone_type = phone_type
             recipient.name = name
             recipient.email = email
             recipient.notifier = notif
         else:
             recipient = Recipient(phone_number=phone_number, name=name, email=email, phone_type=phone_type,
                                   notifier=notif)
         recipient.put()
     except:
         result_dict = {'status': 'failure'}
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(result_dict))