diff --git a/template.py b/template.py index 41aad67..3fc5ab7 100644 --- a/template.py +++ b/template.py @@ -390,10 +390,11 @@ def post(self, comment_id): a = int(comment_id) key = db.Key.from_path('Comment_db', int(comment_id), parent=None) comment_row = db.get(key) - if comment_row.posted_by == self.read_secure_cookie("username"): - comment_row.comment = comment - comment_row.put() - self.redirect("/blog") + if comment_row: + if comment_row.posted_by == self.read_secure_cookie("username"): + comment_row.comment = comment + comment_row.put() + self.redirect("/blog") else: self.redirect("/blog/login") # comment delete @@ -449,10 +450,11 @@ def post(self, post_id): a = int(post_id) key = db.Key.from_path('Blog', int(post_id), parent=None) post_row = db.get(key) - if post_row.posted_by == self.read_secure_cookie("username"): - post_row.post = edited_post - post_row.put() - self.redirect("/blog") + if post_row: + if post_row.posted_by == self.read_secure_cookie("username"): + post_row.post = edited_post + post_row.put() + self.redirect("/blog") else: self.redirect("/blog/login") # post delete diff --git a/template.pyc b/template.pyc index 75340fe..f558126 100644 Binary files a/template.pyc and b/template.pyc differ diff --git a/templates/signup.html b/templates/signup.html index 8d6bf89..913e5f3 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -1,11 +1,6 @@ - +{% extends "base.html" %} - -
-