diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index 5195c9c5a..f43de34a2 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -60,7 +60,6 @@ class SimpleRateThrottle(BaseThrottle): Previous request information used for throttling is stored in the cache. """ cache = default_cache - timer = staticmethod(time.time) cache_format = 'throttle_%(scope)s_%(ident)s' scope = None THROTTLE_RATES = api_settings.DEFAULT_THROTTLE_RATES @@ -131,6 +130,10 @@ class SimpleRateThrottle(BaseThrottle): return self.throttle_failure() return self.throttle_success() + def timer(self): + """Time in seconds since the epoch.""" + return time.time() + def throttle_success(self): """ Inserts the current request's timestamp along with the key