Removed path_subtitle as a decorator

This commit is contained in:
saksham1115 2016-07-19 18:15:36 +00:00
parent eaeed602d3
commit c36c683304
2 changed files with 4 additions and 29 deletions

View File

@ -120,30 +120,6 @@ def active_user_from_url(controller):
return wrapper
def path_subtitle(controller):
"""Retrieve <path> 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 <path> 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):
"""

View File

@ -27,7 +27,7 @@ from mediagoblin import mg_globals
from mediagoblin.plugins.custom_subtitles import forms
from mediagoblin.decorators import (require_active_login, active_user_from_url,
get_media_entry_by_id, path_subtitle, user_may_delete_media)
get_media_entry_by_id, user_may_delete_media)
from mediagoblin.tools.metadata import (compact_and_validate, DEFAULT_CHECKER,
DEFAULT_SCHEMA)
from mediagoblin.tools.response import (render_to_response,
@ -101,8 +101,8 @@ def edit_subtitles(request, media):
@require_active_login
@get_media_entry_by_id
@user_may_delete_media
@path_subtitle
def custom_subtitles(request,media,path=None):
path = request.matchdict['path']
text=""
text = open_subtitle(path)
form = forms.CustomizeSubtitlesForm(request.form,
@ -132,9 +132,8 @@ def custom_subtitles(request,media,path=None):
@require_active_login
@get_media_entry_by_id
@user_may_delete_media
@path_subtitle
def delete_subtitles(request,media,path=None):
def delete_subtitles(request,media):
path = request.matchdict['path']
path = get_path(path)
mg_globals.public_store.delete_file(path)
delete_container = None