comparison forums/management/commands/topic_export.py @ 991:4aadaf3bc234

Added SITE_SCHEME setting. Configure site scheme to be either http or https based on SITE_SCHEME setting. Updated code to use it.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 Nov 2015 15:56:05 -0600
parents 91de9b15b410
children
comparison
equal deleted inserted replaced
990:81b96f3c9e59 991:4aadaf3bc234
7 """ 7 """
8 from __future__ import with_statement 8 from __future__ import with_statement
9 from optparse import make_option 9 from optparse import make_option
10 import re 10 import re
11 11
12 from django.conf import settings
12 from django.core.management.base import LabelCommand, CommandError 13 from django.core.management.base import LabelCommand, CommandError
13 from django.template.loader import render_to_string, TemplateDoesNotExist 14 from django.template.loader import render_to_string, TemplateDoesNotExist
14 15
15 from forums.models import Topic 16 from forums.models import Topic
16 17
17 18
18 SRC_RE = re.compile(r'src="/media/') 19 SRC_RE = re.compile(r'src="/media/')
19 SRC_REPL = 'src="http://surfguitar101.com/media/' 20 SRC_REPL = 'src="{}://surfguitar101.com/media/'.format(settings.SITE_SCHEME)
20 21
21 22
22 class Command(LabelCommand): 23 class Command(LabelCommand):
23 help = "Exports a forum topic thread by rendering it through a given template" 24 help = "Exports a forum topic thread by rendering it through a given template"
24 option_list = LabelCommand.option_list + ( 25 option_list = LabelCommand.option_list + (