From 2c36555bfe4b21880d82b95c4c7a676967f10f96 Mon Sep 17 00:00:00 2001 From: saksham1115 Date: Tue, 28 Jun 2016 06:58:22 +0000 Subject: [PATCH] Converting the path to subtitle into a tuple --- mediagoblin/edit/views.py | 3 +++ .../templates/mediagoblin/user_pages/media.html | 2 +- mediagoblin/tools/subtitles.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 mediagoblin/tools/subtitles.py diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 6d3e684b..33643bf8 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -580,10 +580,13 @@ def edit_metadata(request, media): 'media':media}) +from mediagoblin.tools.subtitles import get_path + @require_active_login @path_subtitle def custom_subtitles(request,path=None): form = forms.CustomizeSubtitlesForm(request.form) + path = get_path(path) return render_to_response( request, "mediagoblin/edit/custom_subtitles.html", diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index a44f6377..3d28cf76 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -236,7 +236,7 @@
  • - {{- subtitle.filepath -}} + {{- subtitle.name -}}
  • {%- endfor %} diff --git a/mediagoblin/tools/subtitles.py b/mediagoblin/tools/subtitles.py new file mode 100644 index 00000000..7002cdfc --- /dev/null +++ b/mediagoblin/tools/subtitles.py @@ -0,0 +1,10 @@ +import ast + +def get_path(path): + """ + Converting the path of the form + x = u'[ "A","B","C" ," D"]' + to + x = ["A", "B", "C", "D"] + """ + return ast.literal_eval(path) \ No newline at end of file