Get max_blog_count variable from config_spec.ini file using pluginapi config.
authorAditi Mittal <aditi.iitr@gmail.com>
Sat, 7 Sep 2013 20:58:48 +0000 (02:28 +0530)
committerAditi Mittal <aditi.iitr@gmail.com>
Sat, 7 Sep 2013 20:58:48 +0000 (02:28 +0530)
mediagoblin/media_types/blog/views.py

index 30827364ec18830bb96ac3088a1958995e54cef8..f778657f6ebc9093d1de987f6c0e2f3a600db0f0 100644 (file)
@@ -20,6 +20,7 @@ _log = logging.getLogger(__name__)
 from datetime import datetime
 
 from werkzeug.exceptions import Forbidden
+from mediagoblin.tools import pluginapi
 
 from mediagoblin import mg_globals
 
@@ -55,8 +56,8 @@ def blog_edit(request):
     url_user = request.matchdict.get('user', None)
     blog_slug = request.matchdict.get('blog_slug', None)
     
-    
-    max_blog_count = 4
+    config = pluginapi.get_config('mediagoblin.media_types.blog')
+    max_blog_count = config['max_blog_count']
     form = blog_forms.BlogEditForm(request.form)
     # the blog doesn't exists yet
     if not blog_slug:
@@ -211,8 +212,6 @@ def blog_dashboard(request, page):
        url_user = request.matchdict.get('user')
        user = request.db.User.query.filter_by(username=url_user).one()
        blog_slug = request.matchdict.get('blog_slug', None)
-       max_blog_count = 4
-       #_log.info(dir(mg_globals.app_config['max_blog_count']))
        blogs = request.db.Blog.query.filter_by(author=user.id)
        if (request.user and request.user.id == user.id) or (request.user and request.user.is_admin):
                if blog_slug: