write a function to extract blog post state from create/edit form.
authorAditi <aditi.iitr@gmail.com>
Wed, 7 Aug 2013 12:28:01 +0000 (17:58 +0530)
committerAditi <aditi.iitr@gmail.com>
Wed, 7 Aug 2013 12:28:01 +0000 (17:58 +0530)
mediagoblin/media_types/blog/lib.py

index f95ecca54678dc1dda64d4fa4cd5be0793b26527..0725b5b6c4499e30f8b3ae94fe8aa1eb7807d06d 100644 (file)
@@ -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'