diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-03-30 17:35:12 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-03-30 17:35:12 +0000 |
| commit | 5fa11b00352ec14c30a1eeea1377339adc8fc3ff (patch) | |
| tree | f6c50beef6e844c1f8e6ec64c685f41a198a47a0 /django/contrib | |
| parent | c922a046755db20d08c714b469503d3dcb5e0dfc (diff) | |
Removed Django 1.2 compatibility fallback for contrib.comments forms hash.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib')
| -rw-r--r-- | django/contrib/comments/forms.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/django/contrib/comments/forms.py b/django/contrib/comments/forms.py index a0cfc2452c..d497572488 100644 --- a/django/contrib/comments/forms.py +++ b/django/contrib/comments/forms.py @@ -1,5 +1,4 @@ import datetime -import hashlib import time from django import forms from django.forms.util import ErrorDict @@ -47,12 +46,7 @@ class CommentSecurityForm(forms.Form): expected_hash = self.generate_security_hash(**security_hash_dict) actual_hash = self.cleaned_data["security_hash"] if not constant_time_compare(expected_hash, actual_hash): - # Fallback to Django 1.2 method for compatibility - # PendingDeprecationWarning <- here to remind us to remove this - # fallback in Django 1.5 - expected_hash_old = self._generate_security_hash_old(**security_hash_dict) - if not constant_time_compare(expected_hash_old, actual_hash): - raise forms.ValidationError("Security hash check failed.") + raise forms.ValidationError("Security hash check failed.") return actual_hash def clean_timestamp(self): @@ -95,12 +89,6 @@ class CommentSecurityForm(forms.Form): value = "-".join(info) return salted_hmac(key_salt, value).hexdigest() - def _generate_security_hash_old(self, content_type, object_pk, timestamp): - """Generate a (SHA1) security hash from the provided info.""" - # Django 1.2 compatibility - info = (content_type, object_pk, timestamp, settings.SECRET_KEY) - return hashlib.sha1("".join(info)).hexdigest() - class CommentDetailsForm(CommentSecurityForm): """ Handles the specific details of the comment (name, comment, etc.). |
