def post(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) return if not is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return answer_text = self.request.get("answer_text") video_key = self.request.get("video_key") question_key = self.request.get("question_key") video = db.get(video_key) question = db.get(question_key) if answer_text and video and question: if len(answer_text) > 500: answer_text = answer_text[0:500] # max answer length, also limited by client answer = models_discussion.Feedback() answer.author = user answer.content = answer_text answer.targets = [video.key(), question.key()] answer.types = [models_discussion.FeedbackType.Answer] db.put(answer) notification.new_answer_for_video_question(video, question, answer) self.redirect("/discussion/answers?question_key=%s" % question_key)
def post(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) return if not is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return question_text = self.request.get("question_text") questions_hidden = self.request.get("questions_hidden") video_key = self.request.get("video_key") video = db.get(video_key) if question_text and video: if len(question_text) > 500: question_text = question_text[0:500] # max question length, also limited by client question = models_discussion.Feedback() question.author = user question.content = question_text question.targets = [video.key()] question.types = [models_discussion.FeedbackType.Question] db.put(question) self.redirect("/discussion/pagequestions?video_key=%s&page=0&questions_hidden=%s" % (video_key, questions_hidden))
def post(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) return if not is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return comment_text = self.request.get("comment_text") comments_hidden = self.request.get("comments_hidden") video_key = self.request.get("video_key") video = db.get(video_key) if comment_text and video: if len(comment_text) > 300: comment_text = comment_text[0:300] # max comment length, also limited by client comment = models_discussion.Feedback() comment.author = user comment.content = comment_text comment.targets = [video.key()] comment.types = [models_discussion.FeedbackType.Comment] db.put(comment) self.redirect("/discussion/pagecomments?video_key=%s&page=0&comments_hidden=%s" % (video_key, comments_hidden))