def post(self): title = self.request.get('title_form') author = self.request.get('author_form') content = self.request.get('content_form') email = self.request.get('email_form') if title == '': title = 'Untitled' if author == '': author = 'Anonymous' if content == '': content = 'Nothing To Say' content = "<br/>".join(content.split("\n")) new_pub = Pub.create_pub(title, author, content) if email: mail.send_mail(sender="Publca <*****@*****.**>", to=email, subject='Publca - %s' % new_pub.title, body='publ.ca/%s' % new_pub.pub_id) self.redirect('/%s' % new_pub.pub_id)
def post(self): title = self.request.get('title_form') author = self.request.get('author_form') content = self.request.get('content_form') email = self.request.get('email_form') if title == '': title = 'Untitled' if author == '': author = 'Anonymous' if content == '': content = 'Nothing To Say' content = "<br/>".join(content.split("\n")) new_pub = Pub.create_pub(title, author, content) if email: mail.send_mail(sender="Publca <*****@*****.**>", to=email, subject='Publca - %s'% new_pub.title , body= 'publ.ca/%s'% new_pub.pub_id ) self.redirect('/%s'% new_pub.pub_id )
def get(self, pub_id): pub = Pub.get_by_id(pub_id) if pub: content_template_values = { 'title': pub.title, 'author': pub.author, 'content': pub.content, 'date': pub.date_published.date().isoformat() } else: content_template_values = { 'title': 'Sorry No Publication Here', 'author': 'No one', 'content': 'Try Something else', 'date': 'Never' } self.response.out.write( RenderPage('text.html', content_template_values))
def get(self, pub_id): pub = Pub.get_by_id(pub_id) if pub: content_template_values = { 'title':pub.title, 'author':pub.author, 'content':pub.content, 'date':pub.date_published.date().isoformat() } else: content_template_values = { 'title': 'Sorry No Publication Here', 'author':'No one', 'content':'Try Something else', 'date':'Never' } self.response.out.write( RenderPage('text.html', content_template_values) )