def show_forum_topic_view(context, request): post_url = model_url(context, request, "comments", "add_comment.html") page_title = context.title actions = [] if has_permission('edit', context, request): actions.append(('Edit', 'edit.html')) if has_permission('delete', context, request): actions.append(('Delete', 'delete.html')) api = request.api api.page_title = page_title byline_info = getMultiAdapter((context, request), IBylineInfo) forum = find_interface(context, IForum) backto = { 'href': model_url(forum, request), 'title': forum.title, } # provide client data for rendering current tags in the tagbox client_json_data = dict( tagbox = get_tags_client_data(context, request), ) # Get a layout layout_provider = get_layout_provider(context, request) layout = layout_provider('community') if support_attachments(context): attachments = fetch_attachments(context['attachments'], request) else: attachments = () # enable imagedrawer for adding forum replies (comments) api.karl_client_data['text'] = dict( enable_imagedrawer_upload = True, ) return render_template_to_response( 'templates/show_forum_topic.pt', api=api, actions=actions, comments=comments_to_display(request), attachments=attachments, formfields=api.formfields, post_url=post_url, byline_info=byline_info, head_data=convert_to_script(client_json_data), backto=backto, layout=layout, comment_form={}, )
def prepare_response(self): """ Prepare all the data needed by a template without actually rendering anything so that subclasses can add additional information as they see fit. """ self.response = {'api':self.request.api, 'profile_currently_viewed':self.profile, 'actions':self.actions, 'head_data':self.head_data, 'communities':self.communities, 'my_communities':self.my_communities, 'preferred_communities':self.preferred_communities, 'tags':self.tags, 'recent_items':[], 'feed_url':model_url(self.context, self.request, "atom.xml"), 'comments':comments_to_display(self.request), }