def post(self, index): post = LogItem.get_by_id(int(index)) a = self.request.get('content') c = self.request.get('tags') post.what = a post.tags = list(set(filter(None, c.split(';')))) post.put() memcache.flush_all() self.redirect("/a/"+index+"/")
def get(self, index): siteData = datamodel.getSiteMeta().__dict__ post = LogItem.get_by_id(int(index)) if post is None: return siteData['post'] = post siteData['singleView'] = True siteData['comments'] = post.comments template = jinja_environment.get_template('template/onepostview.html') self.response.headers['Cache-Control'] = 'max-age=36000, public' self.response.headers['Pragma'] = 'Public' self.response.out.write(template.render(siteData, debug=_DEBUG))
def post(self): b = cgi.escape(self.request.get('whoseComment')) c = cgi.escape(self.request.get('whatComment')) d = cgi.escape(self.request.get('whereComment')) if d == "" : d = u"not provided" e = cgi.escape(self.request.get('postid')) if len(b)>=36: b = b[:35] a = LogItem.get_by_id(int(e)).key() #bad performance. comment = CommentItem(what=c, email=d, who=b, toWhich=a) comment.put() removeCache("/a/"+e+"/") self.redirect("/a/"+e+"/")
def get(self, index): siteData = datamodel.getSiteMeta().__dict__ siteData['index'] = index post = LogItem.get_by_id(int(index)) if post is None: return siteData['post'] = post template = Template(""" <html> <body> <form action="/boom/{{ index }}" method="post"> <div><textarea name="content" rows="30" cols="50">{{ post.what }}</textarea></div> <div><textarea name="tags" rows="30" cols="50">{% for tag in post.tags %}{{ tag }};{% endfor %}</textarea></div> <div><input type="submit" value="Post!"></div> </form> </body> </html>""") self.response.out.write(template.render(siteData, debug=_DEBUG))