Felix Viernickel
129890ab1b
Fix error in throttling when request.user is None ( #8370 )
...
Check to see if request.user is set before proceeding with further
authentication checks.
2022-06-24 13:02:11 +01:00
Yuekui
2051a79da3
Fix "`" typo ( #8529 )
2022-06-24 12:08:18 +01:00
Juan Benitez
cb206e4701
fix: change View class to Throttle class on SimpleRateThrottle Docstring ( #8147 )
2021-09-03 13:00:23 +01:00
Tom Christie
72c155d8f4
Revert "pick deque instead of list ( #7849 )" ( #7872 )
...
This reverts commit ebcb8d5310
.
2021-03-26 09:17:47 +00:00
Jack
ebcb8d5310
pick deque instead of list ( #7849 )
...
Co-authored-by: Jack Zhang <jack.zhang@aspiraconnect.com>
2021-03-25 10:47:44 +00:00
Carlton Gibson
0407a0df8a
Dropped Python 2 compatibility. ( #6615 )
...
Thanks to Jon Dufresne (@jdufresne) for review.
Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com>
2019-04-30 17:53:44 +02:00
Pavlin Gergov
21a9740156
Fix typo in docstring ( #5678 )
2017-12-19 08:45:33 +01:00
Carlton Gibson
c674687782
Remove Django 1.8 & 1.9 compatibility code ( #5481 )
...
* Identify code that needs to be pulled out of/removed from compat.py
* Extract modern code from get_names_and_managers in compat.py and remove compat code
* Extract modern code from is_authenticated() in compat.py and remove.
* Extract modern code from is_anonymous() in compat.py and remove
* Extract modern code from get_related_model() from compat.py and remove
* Extract modern code from value_from_object() in compat.py and remove
* Update postgres compat
JSONField now always available.
* Remove DecimalValidator compat
* Remove get_remote_field compat
* Remove template_render compat
Plus isort.
* Remove set_many compat
* Remove include compat
2017-10-05 20:41:38 +02:00
Tom Christie
11a2468379
Access request.user.is_authenticated
as property not method, under Django 1.10+ ( #4358 )
...
* For Django >=1.10 use user.is_authenticated, not user.is_authenticated()
2016-08-05 11:04:01 +01:00
Stephan Groß
a101251a2a
Fix blank lines around docstrings
2016-03-17 11:06:47 +00:00
José Padilla
83c9136c90
Cleanup import following PEP 8 style guide
2015-06-25 16:10:17 -04:00
Kaptian
fffde8a63b
Update throttling.py
...
Use pk pseudo attribute for identifying the user (in case the user model is not the default and has a different column name for the unique id)
2015-02-05 13:27:26 -08:00
José Padilla
cc13ee0577
Fix error when NUM_PROXIES is greater than one
2015-01-12 08:12:24 -04:00
José Padilla
d6d08db0dd
Fix ident format when using HTTP_X_FORWARDED_FOR
...
If NUM_PROXIES setting is set to None,
HTTP_X_FORWARDED_FOR might be used as is, which
might contain spaces and cause errors on
cache backends like memcached.
2015-01-11 10:58:08 -04:00
Tom Christie
59b47eac14
Fix cache_throttle typo
2014-08-20 12:32:24 +01:00
Xavier Ordoquy
2489e38a06
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/viewsets.md
rest_framework/serializers.py
rest_framework/throttling.py
tests/test_generics.py
tests/test_serializers.py
tox.ini
2014-06-23 14:02:45 +02:00
Xavier Ordoquy
5333a93126
Merge pull request #1409 from tuky/patch-1
...
remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
2014-04-30 21:38:21 +02:00
Xavier Ordoquy
d08536ad9d
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/fields.md
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/authentication.py
rest_framework/serializers.py
rest_framework/templatetags/rest_framework.py
rest_framework/tests/test_authentication.py
rest_framework/tests/test_filters.py
rest_framework/tests/test_hyperlinkedserializers.py
rest_framework/tests/test_serializer.py
rest_framework/tests/test_testing.py
rest_framework/utils/encoders.py
tox.ini
2014-04-13 00:05:57 +02:00
Val Neekman
818b4bf8b3
handle negative time value and prevent a divide by zero
2014-02-27 12:27:54 -08:00
tuky
5e4336845f
Update throttling.py
...
python 3 u'' gone
2014-02-14 13:47:17 +01:00
tuky
d18d32669a
remove spaces from META['HTTP_X_FORWARDED_FOR'] as throttle key
...
memcached cannot handle spaces in keys
2014-02-12 18:11:18 +01:00
Tom Christie
83da4949c0
Allow NUM_PROXIES=0 and include more docs
2013-12-13 00:02:18 +00:00
kahnjw
89f26c5e04
Add get_ident method to pass new tests.
2013-12-06 14:21:52 -08:00
Tom Christie
2d5e14a8d3
Throttles now use HTTP_X_FORWARDED_FOR, falling back to REMOTE_ADDR to identify anonymous requests
2013-08-28 15:32:41 +01:00
Tom Christie
97b52156cc
Added .cache
attribute on throttles.
...
Closes #1066 . More localised than a new settings key, and more
flexible in that different throttles can use different behavior.
Thanks to @chicheng for the report! :)
2013-08-28 13:34:14 +01:00
Tom Christie
f34b9ff049
AnonRateThrottle should always allow authenticated users. Closes #994
2013-08-15 21:36:45 +01:00
Tom Christie
52298480c2
Clean up
2013-06-14 15:39:56 +01:00
Tom Christie
df957c8625
Fix and tests for ScopedRateThrottle. Closes #935
2013-06-14 14:18:40 +01:00
Tom Christie
f8a0d31d71
Remove ConfigurationError in favor of Django's ImproperlyConfigured
2013-06-05 13:45:28 +01:00
Tom Christie
95abe6e844
Cleanup docstrings
2013-04-25 12:47:34 +01:00
Tom Christie
b052c92ac3
Cleanup imports
...
Mostly adding `from __future__ import unicode_literals` everywhere.
2013-02-04 20:55:35 +00:00
Marko Tibold
4d90bb4af4
Fix some typos.
2012-10-30 00:30:52 +01:00
Marko Tibold
71a93930fd
Fixing spelling errors.
2012-10-21 16:34:07 +02:00
eofs
520a183cc6
Typo in class name
2012-10-17 10:41:23 +03:00
Tom Christie
ccd2b0117d
Permissions and throttles no longer have a view attribute on self. Explicitly passed to .has_permissions(request, view, obj=None) / .allow_request(request, view)
2012-10-10 10:02:37 +01:00
Tom Christie
0cc7030aab
Fix @api_view decorator tests
2012-09-26 21:47:19 +01:00
Tom Christie
d9cba6398e
Clean up bits of templates etc
2012-09-20 17:44:34 +01:00
Tom Christie
4b691c4027
Change package name: djangorestframework -> rest_framework
2012-09-20 13:06:27 +01:00