aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages/views.py
diff options
context:
space:
mode:
authorAaron Williamson <aaron@copiesofcopies.org>2011-10-03 21:03:36 -0400
committerAaron Williamson <aaron@copiesofcopies.org>2011-10-03 21:03:36 -0400
commit7298ffa11b1e9f46598d4514bdd13721f003261e (patch)
tree494f769b8d7ce32e496ea54ee592a970c03d00ca /mediagoblin/user_pages/views.py
parent4d7a93a49303344830021bab5a741148b1adb7c3 (diff)
downloadmediagoblin-7298ffa11b1e9f46598d4514bdd13721f003261e.tar.lz
mediagoblin-7298ffa11b1e9f46598d4514bdd13721f003261e.tar.xz
mediagoblin-7298ffa11b1e9f46598d4514bdd13721f003261e.zip
Added a check to prevent blank messages from being posted.
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r--mediagoblin/user_pages/views.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 9cec74dc..1d92d489 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -133,14 +133,19 @@ def media_post_comment(request):
comment['media_entry'] = ObjectId(request.matchdict['media'])
comment['author'] = request.user['_id']
comment['content'] = unicode(request.POST['comment_content'])
-
comment['content_html'] = cleaned_markdown_conversion(comment['content'])
- comment.save()
+ if not comment['content'].strip():
+ messages.add_message(
+ request,
+ messages.ERROR,
+ _("Empty comments are not allowed."))
+ else:
+ comment.save()
- messages.add_message(
- request, messages.SUCCESS,
- 'Comment posted!')
+ messages.add_message(
+ request, messages.SUCCESS,
+ 'Comment posted!')
return redirect(request, 'mediagoblin.user_pages.media_home',
media = request.matchdict['media'],