Mercurial > public > sg101
diff forums/views/main.py @ 963:4619290d171d
Whitelist hot-linked image sources.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 01 Sep 2015 20:33:40 -0500 |
parents | 0ca691cccf8d |
children | e1c03da72818 |
line wrap: on
line diff
--- a/forums/views/main.py Tue Aug 04 16:58:17 2015 -0500 +++ b/forums/views/main.py Tue Sep 01 20:33:40 2015 -0500 @@ -359,7 +359,12 @@ }, context_instance=RequestContext(request)) - return HttpResponseBadRequest("Oops, did you forget some text?"); + # The client side javascript is pretty simplistic right now and we don't + # want to change it yet. It is expecting a single error string. Just grab + # the first error message and use that. + errors = form.errors.as_data() + msg = errors.values()[0][0].message if errors else 'Unknown error' + return HttpResponseBadRequest(msg) def _goto_post(post): @@ -439,7 +444,7 @@ return HttpResponseRedirect(reverse('antispam-suspended')) post = form.save(commit=False) post.touch() - post.save() + post.save(html=form.body_html) notify_updated_post(post) # if we are editing a first post, save the parent topic as well @@ -589,7 +594,7 @@ post.topic = topic post.user = request.user post.user_ip = request.META.get("REMOTE_ADDR", "") - post.save() + post.save(html=form.body_html) notify_new_post(post) # Save any attachments