Django

Code

Changeset 9121

Show
Ignore:
Timestamp:
10/05/08 00:10:35 (3 months ago)
Author:
mtredinnick
Message:

Fixed #8963 -- Use the require_POST decorator instead of doing things manually in one of the comment views. Thanks, zgoda.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/comments/views/comments.py

    r9119 r9121  
    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 
     
    2930    errors a preview template, ``comments/preview.html``, will be rendered. 
    3031    """ 
    31  
    32     # Require POST 
    33     if request.method != 'POST': 
    34         return http.HttpResponseNotAllowed(["POST"]) 
    35  
    3632    # Fill out some initial data fields from an authenticated user, if present 
    3733    data = request.POST.copy() 
     
    117113    return next_redirect(data, next, comment_done, c=comment._get_pk_val()) 
    118114 
     115post_comment = require_POST(post_comment) 
     116 
    119117comment_done = confirmation_view( 
    120118    template = "comments/posted.html",