Add url mapping to it, to have a complete media_type plugin.
authorAditi <aditi.iitr@gmail.com>
Wed, 7 Aug 2013 15:01:34 +0000 (20:31 +0530)
committerAditi <aditi.iitr@gmail.com>
Wed, 7 Aug 2013 15:01:34 +0000 (20:31 +0530)
mediagoblin/media_types/blog/__init__.py

index a579a179d983f1b1b2bb11381ac33da10fe2bea5..cb113ec091fa1c72e52094683ecfd5207e381ea9 100644 (file)
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import os
+import logging
+_log = logging.getLogger(__name__)
+
 from mediagoblin.media_types import MediaManagerBase
 
 from mediagoblin.tools import pluginapi
 
+PLUGIN_DIR = os.path.dirname(__file__)
 MEDIA_TYPE = 'mediagoblin.media_types.blogpost'
 
 def setup_plugin():
     config = pluginapi.get_config(MEDIA_TYPE)
-
+    _log.info("setting up blog media type plugin.")
+    
+    routes = [  
+        #blog_create
+        ('mediagoblin.media_types.blog.create',                         
+        '/u/<string:user>/b/create/',
+        'mediagoblin.media_types.blog.views:blog_edit'
+        ), 
+         #blog_edit        
+        ('mediagoblin.media_types.blog.edit',                          
+        '/u/<string:user>/b/<string:blog_slug>/edit/',          
+        'mediagoblin.media_types.blog.views:blog_edit'
+        ),
+        #blog post create
+        ('mediagoblin.media_types.blog.blogpost.create',                
+        '/u/<string:user>/b/<string:blog_slug>/p/create/',
+        'mediagoblin.media_types.blog.views:blogpost_create'
+        ),
+        #blog post edit
+        ('mediagoblin.media_types.blog.blogpost.edit',                  
+        '/u/<string:user>/b/<string:blog_slug>/p/<string:blog_post_slug>/edit/',
+        'mediagoblin.media_types.blog.views:blogpost_edit'
+        ),
+        #blog admin dashboard
+        ('mediagoblin.media_types.blog.blog-dashboard',
+        '/u/<string:user>/b/<string:blog_slug>/blog_dashboard/',
+        'mediagoblin.media_types.blog.views:blog_dashboard'
+        ),
+        #blog post listing view
+        ('mediagoblin.media_types.blog.blog_post_listing',
+        '/u/<string:user>/b/',
+        'mediagoblin.media_types.blog.views:blog_post_listing'
+        ),
+        #blog post draft view
+        ('mediagoblin.media_types.blog.blogpost_draft_view', 
+        '/u/<string:user>/b/<string:blog_slug>/p/<string:blog_post_slug>/draft/',
+        'mediagoblin.media_types.blog.views:draft_view')
+        ]
+            
+            
+    pluginapi.register_routes(routes)
+    pluginapi.register_template_path(os.path.join(PLUGIN_DIR, 'templates'))
+    
+    
 class BlogPostMediaManager(MediaManagerBase):
     human_readable = "Blog Post"
     display_template = "mediagoblin/media_displays/blogpost.html"
     default_thumb = "images/media_thumbs/blogpost.jpg"
     
-def get_media_type_and_manager(ext):
+def get_media_type_and_manager():
         return MEDIA_TYPE, BlogPostMediaManager
 
-
 hooks = {
     'setup': setup_plugin,
     'get_media_type_and_manager': get_media_type_and_manager,