From 59b47eac14778767a17e56bd8adc0610417f2878 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 20 Aug 2014 12:32:24 +0100 Subject: [PATCH] Fix cache_throttle typo --- docs/topics/2.4-accouncement.md | 11 +++++++++++ docs/topics/release-notes.md | 1 + rest_framework/throttling.py | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/topics/2.4-accouncement.md b/docs/topics/2.4-accouncement.md index 504842872..e3f9d57a8 100644 --- a/docs/topics/2.4-accouncement.md +++ b/docs/topics/2.4-accouncement.md @@ -97,6 +97,17 @@ Here's an example of using the new decorators. Firstly we have a detail-type rou For more details, see the [viewsets documentation](../api-guide/viewsets.md). +## Throttle behavior + +There's one bugfix in 2.4 that's worth calling out, as it will *invalidate existing throttle caches* when you upgrade. + +We've now fixed a typo on the `cache_format` attribute. Previously this was named `"throtte_%(scope)s_%(ident)s"`, it is now `"throttle_%(scope)s_%(ident)s"`. + +If you're concerned about the invalidation you have two options. + +* Manually pre-populate your cache with the fixed version. +* Set the `cache_format` attribute on your throttle class in order to retain the previous incorrect spelling. + ## Other features There are also a number of other features and bugfixes as [listed in the release notes][2-4-release-notes]. In particular these include: diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index a31be28f1..0a74a27d3 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -62,6 +62,7 @@ You can determine your currently installed version using `pip freeze`: * Bugfix: Copy `filter_backends` list before returning it, in order to prevent view code from mutating the class attribute itself. * Bugfix: Set the `.action` attribute on viewsets when introspected by `OPTIONS` for testing permissions on the view. * Bugfix: Ensure `ValueError` raised during deserialization results in a error list rather than a single error. This is now consistent with other validation errors. +* Bugfix: Fix `cache_format` typo on throttle classes, was `"throtte_%(scope)s_%(ident)s"`. Note that this will invalidate existing throttle caches. --- diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index 7e9f9d717..361dbddf0 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -60,7 +60,7 @@ class SimpleRateThrottle(BaseThrottle): cache = default_cache timer = time.time - cache_format = 'throtte_%(scope)s_%(ident)s' + cache_format = 'throttle_%(scope)s_%(ident)s' scope = None THROTTLE_RATES = api_settings.DEFAULT_THROTTLE_RATES