From edd696292ca50cb9c10b50b0124a79135d007ea4 Mon Sep 17 00:00:00 2001
From: Dan Stephenson
Date: Sat, 10 Aug 2013 01:12:36 +0100
Subject: Spelling correction on read_only_fields err msg
---
rest_framework/serializers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'rest_framework')
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 682a99a4..25825df4 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -683,7 +683,7 @@ class ModelSerializer(Serializer):
# in the `read_only_fields` option
for field_name in self.opts.read_only_fields:
assert field_name not in self.base_fields.keys(), \
- "field '%s' on serializer '%s' specfied in " \
+ "field '%s' on serializer '%s' specified in " \
"`read_only_fields`, but also added " \
"as an explict field. Remove it from `read_only_fields`." % \
(field_name, self.__class__.__name__)
--
cgit v1.2.3
From bbdcbe945248c5448540a1ab746b8a4b8bc8f95b Mon Sep 17 00:00:00 2001
From: Dan Stephenson
Date: Sat, 10 Aug 2013 01:22:47 +0100
Subject: Spelling correction on read_only_fields err msg
just spotted extras---
rest_framework/serializers.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'rest_framework')
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 682a99a4..9e85cb46 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -685,10 +685,10 @@ class ModelSerializer(Serializer):
assert field_name not in self.base_fields.keys(), \
"field '%s' on serializer '%s' specfied in " \
"`read_only_fields`, but also added " \
- "as an explict field. Remove it from `read_only_fields`." % \
+ "as an explicit field. Remove it from `read_only_fields`." % \
(field_name, self.__class__.__name__)
assert field_name in ret, \
- "Noexistant field '%s' specified in `read_only_fields` " \
+ "Non-existant field '%s' specified in `read_only_fields` " \
"on serializer '%s'." % \
(field_name, self.__class__.__name__)
ret[field_name].read_only = True
--
cgit v1.2.3
From cd5f1bb229f82cb1bf00c322fd5b688cf0638e97 Mon Sep 17 00:00:00 2001
From: Yuri Prezument
Date: Mon, 12 Aug 2013 15:41:48 +0300
Subject: Fix PATCH button title in template
---
rest_framework/templates/rest_framework/base.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'rest_framework')
diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html
index 9d939e73..51f9c291 100644
--- a/rest_framework/templates/rest_framework/base.html
+++ b/rest_framework/templates/rest_framework/base.html
@@ -196,7 +196,7 @@
{% endif %}
{% if raw_data_patch_form %}
-
+
{% endif %}
--
cgit v1.2.3
From 1d8a80f5cc41f157403771439f15c9b7d615a43b Mon Sep 17 00:00:00 2001
From: Jeremy Satterfield
Date: Tue, 13 Aug 2013 15:31:58 -0500
Subject: don't set X-Throttle-Wait-Second header if throttle wait is None
---
rest_framework/tests/test_throttling.py | 33 ++++++++++++++++++++++++++++++++-
rest_framework/views.py | 2 +-
2 files changed, 33 insertions(+), 2 deletions(-)
(limited to 'rest_framework')
diff --git a/rest_framework/tests/test_throttling.py b/rest_framework/tests/test_throttling.py
index 19bc691a..41bff692 100644
--- a/rest_framework/tests/test_throttling.py
+++ b/rest_framework/tests/test_throttling.py
@@ -7,7 +7,7 @@ from django.contrib.auth.models import User
from django.core.cache import cache
from rest_framework.test import APIRequestFactory
from rest_framework.views import APIView
-from rest_framework.throttling import UserRateThrottle, ScopedRateThrottle
+from rest_framework.throttling import BaseThrottle, UserRateThrottle, ScopedRateThrottle
from rest_framework.response import Response
@@ -21,6 +21,14 @@ class User3MinRateThrottle(UserRateThrottle):
scope = 'minutes'
+class NonTimeThrottle(BaseThrottle):
+ def allow_request(self, request, view):
+ if not hasattr(self.__class__, 'called'):
+ self.__class__.called = True
+ return True
+ return False
+
+
class MockView(APIView):
throttle_classes = (User3SecRateThrottle,)
@@ -35,6 +43,13 @@ class MockView_MinuteThrottling(APIView):
return Response('foo')
+class MockView_NonTimeThrottling(APIView):
+ throttle_classes = (NonTimeThrottle,)
+
+ def get(self, request):
+ return Response('foo')
+
+
class ThrottlingTests(TestCase):
def setUp(self):
"""
@@ -140,6 +155,22 @@ class ThrottlingTests(TestCase):
(80, None)
))
+ def test_non_time_throttle(self):
+ """
+ Ensure for second based throttles.
+ """
+ request = self.factory.get('/')
+
+ self.assertFalse(hasattr(MockView_NonTimeThrottling.throttle_classes[0], 'called'))
+
+ response = MockView_NonTimeThrottling.as_view()(request)
+ self.assertFalse('X-Throttle-Wait-Seconds' in response)
+
+ self.assertTrue(MockView_NonTimeThrottling.throttle_classes[0].called)
+
+ response = MockView_NonTimeThrottling.as_view()(request)
+ self.assertFalse('X-Throttle-Wait-Seconds' in response)
+
class ScopedRateThrottleTests(TestCase):
"""
diff --git a/rest_framework/views.py b/rest_framework/views.py
index 37bba7f0..d51233a9 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -269,7 +269,7 @@ class APIView(View):
Handle any exception that occurs, by returning an appropriate response,
or re-raising the error.
"""
- if isinstance(exc, exceptions.Throttled):
+ if isinstance(exc, exceptions.Throttled) and exc.wait is not None:
# Throttle wait header
self.headers['X-Throttle-Wait-Seconds'] = '%d' % exc.wait
--
cgit v1.2.3
From 2f03870ae12479cbfdce68db1a30bad6fa15b311 Mon Sep 17 00:00:00 2001
From: JT
Date: Tue, 13 Aug 2013 18:48:49 -0500
Subject: Fix for "No module named compat"
---
rest_framework/fields.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'rest_framework')
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index f9931887..add9d224 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -924,7 +924,7 @@ class ImageField(FileField):
if f is None:
return None
- from compat import Image
+ from rest_framework.compat import Image
assert Image is not None, 'PIL must be installed for ImageField support'
# We need to get a file object for PIL. We might have a path or we might
--
cgit v1.2.3
From 486f4c8047b18cc753e1969079b58ca3da6ab43f Mon Sep 17 00:00:00 2001
From: Chad Barrington
Date: Wed, 14 Aug 2013 15:18:44 -0500
Subject: Update filters.py
Here's a little cleanup for ya, brah!---
rest_framework/filters.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'rest_framework')
diff --git a/rest_framework/filters.py b/rest_framework/filters.py
index c058bc71..fbfdd099 100644
--- a/rest_framework/filters.py
+++ b/rest_framework/filters.py
@@ -134,7 +134,7 @@ class OrderingFilter(BaseFilterBackend):
ordering = self.remove_invalid_fields(queryset, ordering)
if not ordering:
- # Use 'ordering' attribtue by default
+ # Use 'ordering' attribute by default
ordering = self.get_default_ordering(view)
if ordering:
--
cgit v1.2.3
From 99083baf25d3145d034336b2569b79488cf1662b Mon Sep 17 00:00:00 2001
From: Chad Barrington
Date: Wed, 14 Aug 2013 16:01:25 -0500
Subject: Update filters.py
Fixed cut n pasted get_ordering docstring for ya bro.---
rest_framework/filters.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'rest_framework')
diff --git a/rest_framework/filters.py b/rest_framework/filters.py
index fbfdd099..4079e1bd 100644
--- a/rest_framework/filters.py
+++ b/rest_framework/filters.py
@@ -109,8 +109,7 @@ class OrderingFilter(BaseFilterBackend):
def get_ordering(self, request):
"""
- Search terms are set by a ?search=... query parameter,
- and may be comma and/or whitespace delimited.
+ Ordering is set by a comma delimited ?ordering=... query parameter.
"""
params = request.QUERY_PARAMS.get(self.ordering_param)
if params:
--
cgit v1.2.3
From f34b9ff0498ca054bfe65b4da99b01d48ff052b8 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Thu, 15 Aug 2013 21:36:45 +0100
Subject: AnonRateThrottle should always allow authenticated users. Closes
#994
---
rest_framework/throttling.py | 3 +++
1 file changed, 3 insertions(+)
(limited to 'rest_framework')
diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py
index f6bb1cc8..65b45593 100644
--- a/rest_framework/throttling.py
+++ b/rest_framework/throttling.py
@@ -96,6 +96,9 @@ class SimpleRateThrottle(BaseThrottle):
return True
self.key = self.get_cache_key(request, view)
+ if self.key is None:
+ return True
+
self.history = cache.get(self.key, [])
self.now = self.timer()
--
cgit v1.2.3
From f6f69dc71d4db7492b5feecc69627dff0031e2b9 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 16 Aug 2013 14:03:20 +0100
Subject: Version 2.3.7
---
rest_framework/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'rest_framework')
diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py
index 776618ac..087808e0 100644
--- a/rest_framework/__init__.py
+++ b/rest_framework/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '2.3.6'
+__version__ = '2.3.7'
VERSION = __version__ # synonym
--
cgit v1.2.3