Added year option to throtting.

This commit is contained in:
Belen-mapplas 2014-06-11 08:12:51 +00:00
parent e8ec81f5e9
commit 2d22d09c88

View File

@ -83,7 +83,7 @@ class SimpleRateThrottle(BaseThrottle):
return (None, None)
num, period = rate.split('/')
num_requests = int(num)
duration = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}[period[0]]
duration = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400, 'y': 31536000}[period[0]]
return (num_requests, duration)
def allow_request(self, request, view):