aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r--mediagoblin/tools/response.py2
-rw-r--r--mediagoblin/tools/template.py4
-rw-r--r--mediagoblin/tools/text.py5
3 files changed, 7 insertions, 4 deletions
diff --git a/mediagoblin/tools/response.py b/mediagoblin/tools/response.py
index b01d31a2..c905097c 100644
--- a/mediagoblin/tools/response.py
+++ b/mediagoblin/tools/response.py
@@ -30,7 +30,7 @@ def render_404(request):
Render a 404.
"""
return render_to_response(
- request, 'mediagoblin/404.html', {}, status=400)
+ request, 'mediagoblin/404.html', {}, status=404)
def redirect(request, *args, **kwargs):
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index f48b7c2e..d0400347 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -79,7 +79,9 @@ def render_template(request, template_path, context):
template = request.template_env.get_template(
template_path)
context['request'] = request
- context['csrf_token'] = render_csrf_form_token(request)
+ rendered_csrf_token = render_csrf_form_token(request)
+ if rendered_csrf_token is not None:
+ context['csrf_token'] = render_csrf_form_token(request)
rendered = template.render(context)
if common.TESTS_ENABLED:
diff --git a/mediagoblin/tools/text.py b/mediagoblin/tools/text.py
index be1adb00..d576224d 100644
--- a/mediagoblin/tools/text.py
+++ b/mediagoblin/tools/text.py
@@ -43,6 +43,7 @@ HTML_CLEANER = Cleaner(
host_whitelist=(),
whitelist_tags=set([]))
+TAGS_DELIMITER=',';
def clean_html(html):
# clean_html barfs on an empty string
@@ -67,7 +68,7 @@ def convert_to_tag_list_of_dicts(tag_string):
# Split the tag string into a list of tags
for tag in stripped_tag_string.split(
- mg_globals.app_config['tags_delimiter']):
+ TAGS_DELIMITER):
# Ignore empty or duplicate tags
if tag.strip() and tag.strip() not in [t['name'] for t in taglist]:
@@ -85,7 +86,7 @@ def media_tags_as_string(media_entry_tags):
"""
media_tag_string = ''
if media_entry_tags:
- media_tag_string = mg_globals.app_config['tags_delimiter'].join(
+ media_tag_string = (TAGS_DELIMITER+u' ').join(
[tag['name'] for tag in media_entry_tags])
return media_tag_string