From: Aditi Date: Wed, 7 Aug 2013 12:28:01 +0000 (+0530) Subject: write a function to extract blog post state from create/edit form. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8c040f77802ac0b02a4f5c21cecd0a5bca3e1c3b;p=mediagoblin.git write a function to extract blog post state from create/edit form. --- diff --git a/mediagoblin/media_types/blog/lib.py b/mediagoblin/media_types/blog/lib.py index f95ecca5..0725b5b6 100644 --- a/mediagoblin/media_types/blog/lib.py +++ b/mediagoblin/media_types/blog/lib.py @@ -27,4 +27,10 @@ def may_edit_blogpost(request, blog): if request.user.is_admin or request.user.id == blog.author: return True return False + +def set_blogpost_state(request, blogpost): + if request.form['status'] == 'Publish': + blogpost.state = u'processed' + else: + blogpost.state = u'failed'