def post(self): subject = utilities.escape_html(self.request.get("subject")) content = utilities.escape_html(self.request.get("content")) if subject and content: p = Post(subject = subject, content = content) p.put() # redirect to permalink for entry post_id = str(p.key().id()) self.redirect("/blog/post/" + post_id) else: error = "Please enter both subject and content." self.render("post_form.html", subject=subject, content=content, error=error)
def post(self): user_username = utilities.escape_html(self.request.get('username')) user_password = utilities.escape_html(self.request.get('password')) user_verify = utilities.escape_html(self.request.get('verify')) user_email = utilities.escape_html(self.request.get('email')) username_error = '' password_error = '' password_match_error = '' email_error = '' username = utilities.valid_username(user_username) password = utilities.valid_password(user_password) verify = utilities.valid_password(user_verify) if len(user_email) > 0: email = utilities.valid_email(user_email) else: email = True; error_flag = False; if not username: error_flag = True; username_error = 'That\'s not a valid username.' if not password: error_flag = True; password_error = 'That\'s not a valid password.' if not user_password == user_verify: error_flag = True; password_match_error = 'Your passwords didn\'t match.' if not email: error_flag = True; email_error = 'That\'s not a valid email.' if not error_flag: self.redirect("/welcome?username=%s" % user_username) else: self.write_form(username_error, password_error, password_match_error, email_error, user_username, user_email)
def post(self): user_rot13 = self.request.get('text') user_rot13 = utilities.escape_html(user_rot13) rot13 = user_rot13.encode("rot13") self.write_form(rot13)