Merge remote branch 'aaronw/bug601_blank_comments'

* aaronw/bug601_blank_comments:
  Make Comment posted! translatable.
  Update english translation file.
  Added a check to prevent blank messages from being posted.

Conflicts:
	mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
This commit is contained in:
Elrond 2011-10-15 14:59:52 +02:00
commit b81926f614
2 changed files with 15 additions and 6 deletions

View File

@ -480,7 +480,11 @@ msgstr ""
msgid "I am sure I want to delete this"
msgstr ""
#: mediagoblin/user_pages/views.py:176
#: mediagoblin/user_pages/views.py:142
msgid "Empty comments are not allowed."
msgstr ""
#: mediagoblin/user_pages/views.py:181
msgid "You are about to delete another user's media. Proceed with caution."
msgstr ""

View File

@ -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'],