From: saksham1115 Date: Wed, 8 Jun 2016 18:58:14 +0000 (+0000) Subject: Made decorators views for Customize Interface X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=447d1c2533b2dfffadd0a8febcaf3909c93c4f56;p=mediagoblin.git Made decorators views for Customize Interface --- diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index daeddb3f..30916f14 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -120,6 +120,30 @@ def active_user_from_url(controller): return wrapper +def path_subtitle(controller): + """Retrieve URL pattern and pass in as path=...""" + + + @wraps(controller) + def wrapper(request, *args, **kwargs): + path_sub = request.matchdict['path'] + + return controller(request, *args, path=path_sub, **kwargs) + + return wrapper + +def path_subtitle(controller): + """Retrieve URL pattern and pass in as path=...""" + + + @wraps(controller) + def wrapper(request, *args, **kwargs): + path_sub = request.matchdict['path'] + + return controller(request, *args, path=path_sub, **kwargs) + + return wrapper + def user_may_delete_media(controller): """ diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 0c66451f..b3f4318b 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -17,6 +17,7 @@ import six from datetime import datetime +import os from itsdangerous import BadSignature from pyld import jsonld @@ -34,7 +35,7 @@ from mediagoblin.edit.lib import may_edit_media from mediagoblin.decorators import (require_active_login, active_user_from_url, get_media_entry_by_id, user_may_alter_collection, get_user_collection, user_has_privilege, - user_not_banned) + user_not_banned, path_subtitle) from mediagoblin.tools.crypto import get_timed_signer_url from mediagoblin.tools.metadata import (compact_and_validate, DEFAULT_CHECKER, DEFAULT_SCHEMA) @@ -581,9 +582,11 @@ def edit_metadata(request, media): @require_active_login -def custom_subtitles(request,path): +@path_subtitle +def custom_subtitles(request,path=None): + path = path.encode('ascii','ignore')[1:-1] return render_to_response( request, - "mediagoblin/templates/user_pages/custom_subtitles.html", + "mediagoblin/user_pages/custom_subtitles.html", {"path": path} ) \ No newline at end of file diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py index f7abf7bf..0165ab6c 100644 --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@ -119,3 +119,8 @@ add_route('mediagoblin.edit.subtitles', add_route('mediagoblin.edit.metadata', '/u//m//metadata/', 'mediagoblin.edit.views:edit_metadata') + + +add_route('mediagoblin.edit.custom_subtitles', + '/c_s/', + 'mediagoblin.edit.views:custom_subtitles') \ No newline at end of file