mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Moving from sha module to hashlib.
This commit is contained in:
parent
ac59ba7038
commit
83866a7736
1 changed files with 3 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
||||||
from django.http import HttpResponseForbidden
|
from django.http import HttpResponseForbidden
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import functools, sha
|
import functools
|
||||||
|
import hashlib
|
||||||
|
|
||||||
class ratelimit(object):
|
class ratelimit(object):
|
||||||
"Instances of this class can be used as decorators"
|
"Instances of this class can be used as decorators"
|
||||||
|
@ -101,6 +102,6 @@ class ratelimit_post(ratelimit):
|
||||||
# IP address and key_field (if it is set)
|
# IP address and key_field (if it is set)
|
||||||
extra = super(ratelimit_post, self).key_extra(request)
|
extra = super(ratelimit_post, self).key_extra(request)
|
||||||
if self.key_field:
|
if self.key_field:
|
||||||
value = sha.new(request.POST.get(self.key_field, '')).hexdigest()
|
value = hashlib.sha1(request.POST.get(self.key_field, '')).hexdigest()
|
||||||
extra += '-' + value
|
extra += '-' + value
|
||||||
return extra
|
return extra
|
||||||
|
|
Loading…
Add table
Reference in a new issue