def post(self):
""" Submits data to the server to delete the post """
auth_error = True
if self.read_secure_cookie('usercookie'):
auth_error = False
else:
auth_error = True
username = self.read_secure_cookie('usercookie')
if not self.user_exists(username):
auth_error = False
else:
auth_error = True
if not auth_error:
post_id = self.request.get('post_id')
key = db.Key.from_path('Post',
int(post_id),
parent=blog_key())
# gets the post data based upon what
# is passed from post_id into key
db.delete(key)
self.render('/postdeleted.html')
else:
self.redirect('/signup')
评论列表
文章目录