def _postComment(self): """Handles the POST call for the form that creates comments. """ reply = self.data.GET.get('reply', '') reply = int(reply) if reply.isdigit() else None comment_form = CommentForm(reply, self.data.POST) if not comment_form.is_valid(): return self.get() comment_form.cleaned_data['reply'] = reply comment_form.cleaned_data['created_by'] = self.data.user comment_form.cleaned_data['modified_by'] = self.data.user comment = comment_form.create(commit=False, parent=self.data.task) comment_logic.storeAndNotify(comment) # TODO(ljvderijk): Indicate that a comment was successfully created to the # user. self.redirect.id().to('gci_view_task')
def _postComment(self, data, check, mutator): """Handles the POST call for the form that creates comments.""" reply = data.GET.get('reply', '') reply = int(reply) if reply.isdigit() else None comment_form = CommentForm(reply=reply, data=data.POST) if not comment_form.is_valid(): # TODO(nathaniel): problematic self-call. return self.get(data, check, mutator) comment_form.cleaned_data['reply'] = reply comment_form.cleaned_data['created_by'] = data.ndb_user.key.to_old_key() comment_form.cleaned_data['modified_by'] = data.ndb_user.key.to_old_key() comment = comment_form.create(commit=False, parent=data.task) comment_logic.storeAndNotify(comment) # TODO(ljvderijk): Indicate that a comment was successfully created to the # user. return data.redirect.id().to(url_names.GCI_VIEW_TASK)
def _postComment(self, data, check, mutator): """Handles the POST call for the form that creates comments.""" reply = data.GET.get('reply', '') reply = int(reply) if reply.isdigit() else None comment_form = CommentForm(reply=reply, data=data.POST) if not comment_form.is_valid(): # TODO(nathaniel): problematic self-call. return self.get(data, check, mutator) comment_form.cleaned_data['reply'] = reply comment_form.cleaned_data['created_by'] = data.ndb_user.key.to_old_key( ) comment_form.cleaned_data[ 'modified_by'] = data.ndb_user.key.to_old_key() comment = comment_form.create(commit=False, parent=data.task) comment_logic.storeAndNotify(comment) # TODO(ljvderijk): Indicate that a comment was successfully created to the # user. return data.redirect.id().to(url_names.GCI_VIEW_TASK)