From 45384c6dce364bf7f6dd09bec2ea69fb09856247 Mon Sep 17 00:00:00 2001 From: Aditi Date: Wed, 7 Aug 2013 20:31:34 +0530 Subject: [PATCH] Add url mapping to it, to have a complete media_type plugin. --- mediagoblin/media_types/blog/__init__.py | 53 ++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/mediagoblin/media_types/blog/__init__.py b/mediagoblin/media_types/blog/__init__.py index a579a179..cb113ec0 100644 --- a/mediagoblin/media_types/blog/__init__.py +++ b/mediagoblin/media_types/blog/__init__.py @@ -14,24 +14,71 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +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//b/create/', + 'mediagoblin.media_types.blog.views:blog_edit' + ), + #blog_edit + ('mediagoblin.media_types.blog.edit', + '/u//b//edit/', + 'mediagoblin.media_types.blog.views:blog_edit' + ), + #blog post create + ('mediagoblin.media_types.blog.blogpost.create', + '/u//b//p/create/', + 'mediagoblin.media_types.blog.views:blogpost_create' + ), + #blog post edit + ('mediagoblin.media_types.blog.blogpost.edit', + '/u//b//p//edit/', + 'mediagoblin.media_types.blog.views:blogpost_edit' + ), + #blog admin dashboard + ('mediagoblin.media_types.blog.blog-dashboard', + '/u//b//blog_dashboard/', + 'mediagoblin.media_types.blog.views:blog_dashboard' + ), + #blog post listing view + ('mediagoblin.media_types.blog.blog_post_listing', + '/u//b/', + 'mediagoblin.media_types.blog.views:blog_post_listing' + ), + #blog post draft view + ('mediagoblin.media_types.blog.blogpost_draft_view', + '/u//b//p//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, -- 2.25.1