def handle_submit(self, validated): context = self.context request = self.request name = make_unique_name(context, validated['title']) creator = authenticated_userid(request) text = safe_html(validated['description']) topic = create_content(IForumTopic, validated['title'], text, creator, ) if text: topic.description = extract_description(text) else: topic.description = validated['title'] context[name] = topic if request.POST.get('return_to') is not None: location = request.POST['return_to'] return render_template_to_response('templates/javascript_redirect.pt', url=location) else: location = model_url(topic, request) return HTTPFound(location=location)
def handle_submit(self, converted): context = self.context request = self.request parent = self.parent creator = authenticated_userid(request) log.debug('add_comment.html converted: %s, ctx: %s' % (str(converted), self.context)) comment = create_content( IComment, parent.title, converted['add_comment'], extract_description(converted['add_comment']), creator, ) if not 'comments' in parent.keys(): parent['comments'] = create_content(ICommentsFolder) comments = parent['comments'] next_id = comments.next_id comments[next_id] = comment if support_attachments(comment): upload_attachments(converted['attachments'], comment, creator, request) return self.status_response('Comment added')