From 7764f088c22695a15a852ba1f38e8dda97a6e7d3 Mon Sep 17 00:00:00 2001 From: Samuel Lai Date: Thu, 27 Feb 2014 18:52:25 +1100 Subject: [PATCH] Added a setting to disable the rewriting of links and image URLs. --- python/src/stackdump/app.py | 3 ++- python/src/stackdump/default_settings.py | 3 +++ python/src/stackdump/settings.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/src/stackdump/app.py b/python/src/stackdump/app.py index 1163d84..6043781 100644 --- a/python/src/stackdump/app.py +++ b/python/src/stackdump/app.py @@ -410,7 +410,8 @@ def view_question(site_key, question_id, answer_id=None): result = results.docs[0] convert_comments_to_html(result) - rewrite_result(result) + if settings.REWRITE_LINKS_AND_IMAGES: + rewrite_result(result) sort_answers(result) context['result'] = result diff --git a/python/src/stackdump/default_settings.py b/python/src/stackdump/default_settings.py index cfa600e..a4a9fcc 100644 --- a/python/src/stackdump/default_settings.py +++ b/python/src/stackdump/default_settings.py @@ -32,6 +32,9 @@ NUM_OF_DEFAULT_COMMENTS = 3 # number of random questions to show on search query pages NUM_OF_RANDOM_QUESTIONS = 3 +# rewrite links and images to point internally or to a placeholder respectively +REWRITE_LINKS_AND_IMAGES = True + # settings that are available in templates TEMPLATE_SETTINGS = [ 'APP_URL_ROOT', diff --git a/python/src/stackdump/settings.py b/python/src/stackdump/settings.py index cafc02c..1430ebd 100644 --- a/python/src/stackdump/settings.py +++ b/python/src/stackdump/settings.py @@ -34,3 +34,6 @@ from default_settings import * # number of random questions to show on search query pages #NUM_OF_RANDOM_QUESTIONS = 3 + +# rewrite links and images to point internally or to a placeholder respectively +#REWRITE_LINKS_AND_IMAGES = True