From bed960cba98988ff953ce7bd3b4996af5d4bc18a Mon Sep 17 00:00:00 2001 From: Aditi Date: Thu, 25 Jul 2013 15:00:31 +0530 Subject: [PATCH] Fix blog extraction for get and post both type of requests. --- mediagoblin/media_types/blog/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mediagoblin/media_types/blog/views.py b/mediagoblin/media_types/blog/views.py index d4c78b4d..91688f09 100644 --- a/mediagoblin/media_types/blog/views.py +++ b/mediagoblin/media_types/blog/views.py @@ -85,10 +85,10 @@ def blog_edit(request): user=request.user.username) - + #Blog already exists. else: + blog = Blog.query.filter_by(slug=blog_slug).first() if request.method == 'GET': - blog = Blog.query.filter_by(slug=blog_slug).first() defaults = dict( title = blog.title, description = blog.description, @@ -119,8 +119,11 @@ def blogpost_create(request): form = blog_forms.BlogPostEditForm(request.form, license=request.user.license_preference) - + if request.method == 'POST' and form.validate(): + + _log.info(request.form['status']) + blog_slug = request.matchdict.get('blog_slug') blog = request.db.Blog.query.filter_by(slug=blog_slug, author=request.user.id).first() @@ -220,9 +223,7 @@ def blog_dashboard(request): 'blog_slug':blog_slug, 'blog':blog, 'blog_post_count':blog_post_count - }) - - + }) -- 2.25.1