Made decorators views for Customize Interface
authorsaksham1115 <saksham115@gmail.com>
Wed, 8 Jun 2016 18:58:14 +0000 (18:58 +0000)
committersaksham1115 <saksham115@gmail.com>
Tue, 19 Jul 2016 17:29:08 +0000 (17:29 +0000)
mediagoblin/decorators.py
mediagoblin/edit/views.py
mediagoblin/user_pages/routing.py

index daeddb3f199352258988eef024d4022b705cce29..30916f1473afa399804f9e5b41872d46d8c42041 100644 (file)
@@ -120,6 +120,30 @@ 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):
     """
index 0c66451f362a324779e454459d16f7942f7806cc..b3f4318b4c977f9e846b5306a2281ab5756a472a 100644 (file)
@@ -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
index f7abf7bf7e6adfc4501abe90827af9aa74a99141..0165ab6c8e5b4e7a027aa50ecd627463b1fe2ce9 100644 (file)
@@ -119,3 +119,8 @@ add_route('mediagoblin.edit.subtitles',
 add_route('mediagoblin.edit.metadata',
           '/u/<string:user>/m/<int:media_id>/metadata/',
           'mediagoblin.edit.views:edit_metadata')
+
+
+add_route('mediagoblin.edit.custom_subtitles',
+          '/c_s/<string:path>',
+          'mediagoblin.edit.views:custom_subtitles')
\ No newline at end of file