From f7da3209491d90ea346c8230d34a7d2586110fc1 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 5 Sep 2018 10:11:27 +0200 Subject: [PATCH] pass context_data to render_page_as_text --- content_plugins/shortcuts.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/content_plugins/shortcuts.py b/content_plugins/shortcuts.py index 03b5851..72be31e 100644 --- a/content_plugins/shortcuts.py +++ b/content_plugins/shortcuts.py @@ -7,16 +7,9 @@ from content_editor.contents import contents_for_item from shared.utils.text import html_entities_to_unicode -def render_page_as_text(page, renderer, template, language): +def render_page_as_text(page, template, context_data): request = HttpRequest() request.user = AnonymousUser() - contents = contents_for_item(page, renderer.plugins()) - context = { - 'contents': contents, - 'language': language, - 'page': page, - 'renderer': renderer, - } - html = render_to_string(template, context, request=request) + html = render_to_string(template, context_data, request=request) text = html_entities_to_unicode(strip_tags(html)).strip() return text