Ticket #11611: prefix_for_comment.2.diff

File prefix_for_comment.2.diff, 1.6 KB (added by Alexander Lyabah, 15 years ago)
  • django/contrib/comments/forms.py

     
    2222    timestamp     = forms.IntegerField(widget=forms.HiddenInput)
    2323    security_hash = forms.CharField(min_length=40, max_length=40, widget=forms.HiddenInput)
    2424
    25     def __init__(self, target_object, data=None, initial=None):
     25    def __init__(self, target_object, data=None, initial=None,**kwargs):
    2626        self.target_object = target_object
    2727        if initial is None:
    2828            initial = {}
    2929        initial.update(self.generate_security_data())
    30         super(CommentSecurityForm, self).__init__(data=data, initial=initial)
     30        super(CommentSecurityForm, self).__init__(data=data, initial=initial,**kwargs)
    3131       
    3232    def security_errors(self):
    3333        """Return just those errors associated with security"""
     
    4040    def clean_security_hash(self):
    4141        """Check the security hash."""
    4242        security_hash_dict = {
    43             'content_type' : self.data.get("content_type", ""),
    44             'object_pk' : self.data.get("object_pk", ""),
    45             'timestamp' : self.data.get("timestamp", ""),
     43            'content_type' : self.cleaned_data.get("content_type", ""),
     44            'object_pk' : self.cleaned_data.get("object_pk", ""),
     45            'timestamp' : str(self.cleaned_data.get("timestamp", "")),
    4646        }
    4747        expected_hash = self.generate_security_hash(**security_hash_dict)
    4848        actual_hash = self.cleaned_data["security_hash"]
Back to Top