Exemplo n.º 1
0
 def get(self):
     if (self.request.get("export")):
         subscribers = SubscriberModel.all().fetch(_MAX_FETCH)
         self.response.headers['Content-Type'] = 'text/plain'
         self.response.headers['Content-Disposition'] = 'attachment;filename="MailingList.txt"'
         for s in subscribers:
             self.response.out.write('"' + s.fname + ' ' + s.lname + '"' + ' <' + s.email + '>')
             self.response.out.write("\n")
     else:
         subscribers = SubscriberModel.all().fetch(_MAX_FETCH)
         data = {
             "subscribers":	subscribers,
             "template":	 	"admin/subscriber_view_all.tpl"
         }
         self.generate(template_base, data)
Exemplo n.º 2
0
 def delete(self, id):
     subscriber = SubscriberModel.get(id)
     if subscriber:
         subscriber.delete()
         referrer = self.request.headers['referer']
         self.redirect(referrer)
     else:
         self.error(503)
Exemplo n.º 3
0
 def create(self):
     email_contact 		= SubscriberModel()
     email_contact.fname = self.request.get("fname")
     email_contact.lname = self.request.get("lname")
     email_contact.email = db.Email(self.request.get("email"))
     email_contact.put()
     data = {
         "submitted":	1,
         "fname":		email_contact.fname,
         "lname":		email_contact.lname,
         "email":		email_contact.email,
         "template":		"public/subscriber_confirm.tpl"
     }
     self.generate(base_template, data)