Ticket #11611: prefix_for_comment.2.diff
File prefix_for_comment.2.diff, 1.6 KB (added by , 15 years ago) |
---|
-
django/contrib/comments/forms.py
22 22 timestamp = forms.IntegerField(widget=forms.HiddenInput) 23 23 security_hash = forms.CharField(min_length=40, max_length=40, widget=forms.HiddenInput) 24 24 25 def __init__(self, target_object, data=None, initial=None ):25 def __init__(self, target_object, data=None, initial=None,**kwargs): 26 26 self.target_object = target_object 27 27 if initial is None: 28 28 initial = {} 29 29 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) 31 31 32 32 def security_errors(self): 33 33 """Return just those errors associated with security""" … … 40 40 def clean_security_hash(self): 41 41 """Check the security hash.""" 42 42 security_hash_dict = { 43 'content_type' : self. data.get("content_type", ""),44 'object_pk' : self. data.get("object_pk", ""),45 'timestamp' : s elf.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", "")), 46 46 } 47 47 expected_hash = self.generate_security_hash(**security_hash_dict) 48 48 actual_hash = self.cleaned_data["security_hash"]