Ticket #8963: contrib-comments-requirepost.diff

File contrib-comments-requirepost.diff, 1.1 KB (added by Jarek Zgoda, 16 years ago)
  • django/contrib/comments/views/comments.py

     
    77from django.template import RequestContext
    88from django.template.loader import render_to_string
    99from django.utils.html import escape
     10from django.views.decorators.http import require_POST
    1011from django.contrib import comments
    1112from django.contrib.comments import signals
    1213
     
    2930    errors a preview template, ``comments/preview.html``, will be rendered.
    3031    """
    3132
    32     # Require POST
    33     if request.method != 'POST':
    34         return http.HttpResponseNotAllowed(["POST"])
    35 
    3633    # Fill out some initial data fields from an authenticated user, if present
    3734    data = request.POST.copy()
    3835    if request.user.is_authenticated():
     
    116113    )
    117114
    118115    return next_redirect(data, next, comment_done, c=comment._get_pk_val())
     116post_comment = require_POST(post_comment)
    119117
    120118comment_done = confirmation_view(
    121119    template = "comments/posted.html",
Back to Top