aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin
diff options
context:
space:
mode:
authorsaksham1115 <saksham115@gmail.com>2016-07-19 18:15:36 +0000
committersaksham1115 <saksham115@gmail.com>2016-07-19 18:15:36 +0000
commitc36c6833046b6d1f6aa1b0f274585a1b23b9a5ad (patch)
treec0eb572688633ec5f768659d26496e9eb6d4e11d /mediagoblin
parenteaeed602d3db4eac75c5e0cf92f338e3c991001a (diff)
downloadmediagoblin-c36c6833046b6d1f6aa1b0f274585a1b23b9a5ad.tar.lz
mediagoblin-c36c6833046b6d1f6aa1b0f274585a1b23b9a5ad.tar.xz
mediagoblin-c36c6833046b6d1f6aa1b0f274585a1b23b9a5ad.zip
Removed path_subtitle as a decorator
Diffstat (limited to 'mediagoblin')
-rw-r--r--mediagoblin/decorators.py24
-rw-r--r--mediagoblin/plugins/custom_subtitles/views.py9
2 files changed, 4 insertions, 29 deletions
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index 30916f14..daeddb3f 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -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):
"""
diff --git a/mediagoblin/plugins/custom_subtitles/views.py b/mediagoblin/plugins/custom_subtitles/views.py
index fdda5b37..5ea9cf35 100644
--- a/mediagoblin/plugins/custom_subtitles/views.py
+++ b/mediagoblin/plugins/custom_subtitles/views.py
@@ -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