def get(self, ident): source = Page.fetch_by_key(ident) source.key.delete() subject = 'Deleted {page} from datastore'.format(page=source.name) html_message = self.render_template('delete_email.html', write=False, item=source) send_mail(subject, html=html_message) self.response.write(html_message)
def post(self, ident=None): if ident: source = Page.fetch_by_key(ident) else: source = Page() source.name = self.request.get('name', '') source.url = self.request.get('url', '') source.phrases = self.request.get('phrases', '') key = source.put() self.response.write(key.urlsafe())