Peter Thomassen
d38aab39e4
Remove unused code
2024-04-30 18:28:22 +02:00
Jameel Al-Aziz
15c613a9eb
Allow generic requests, responses, fields, views ( #8825 )
...
Allow Request, Response, Field, and GenericAPIView to be subscriptable.
This allows the classes to be made generic for type checking.
This is especially useful since monkey patching DRF can be problematic
as seen in this [issue][1].
[1]: https://github.com/typeddjango/djangorestframework-stubs/issues/299
2023-02-22 21:39:01 +06:00
Markus Legner
d507cd851c
Fix infinite recursion with deepcopy on Request ( #8684 )
2022-10-07 11:58:38 +01:00
Carlton Gibson
ad282da97c
Replaced parse_header with parse_header_parameters. ( #8556 )
...
Add a backwards compatibility shim for Django versions that have no (or an incompatible)
django.utils.http.parse_header_parameters implementation.
Thanks to Shai Berger for review.
Co-authored-by: Jaap Roes <jroes@leukeleu.nl>
2022-07-14 14:20:36 +02:00
Tom Christie
0323d6f895
Linting fixes ( #7874 )
...
* Fixed code quality issues
- Added '.deepsource.toml' file for continuous analysis on bug risk
- Remove `return` from `__init__()` method
- Remove duplicate dictionary key(s)
- Use `max` built-in to get the maximum of two values
- Remove redundant `None` default
- Remove unnecessary comprehension
Signed-off-by: ankitdobhal <dobhal.ankit@protonmail.com>
* Delete .deepsource.toml
* Delete test_fields.py
* Reintroduce file from accidental deletion
Co-authored-by: ankitdobhal <dobhal.ankit@protonmail.com>
2021-03-26 12:27:10 +00:00
Michael K
0d2bbd3177
Fix Request docstring kwarg names ( #7443 )
2020-08-05 16:51:06 -07:00
Ryan P Kilby
dd33ebb4e2
Add Request repr ( #7239 )
2020-03-29 12:01:14 +01: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
Jon Dufresne
4d57d46bf8
Prefer io.BytesIO over six; available on all supported Pythons ( #6168 )
...
On all supported Pythons, the io.BytesIO is always a stream
implementation using an in-memory bytes buffer.
Makes code slightly more forward compatible by reducing use of the six
module and promotes more forward compatible practices in the docs.
2018-09-09 11:53:41 +01:00
Ryan P Kilby
c456b3c510
Fix request formdata handling ( #5800 )
...
* Rename 'wsgi' request test to more accurate 'http'
* Test duplicate request stream parsing
* Fix setting post/files on the underlying request
2018-02-05 16:24:13 +01:00
Ryan P Kilby
c63e35cb09
Fix AttributeError hiding on request authenticators ( #5600 )
...
* Update assertion style in user logout test
* Apply middlewares to django request object
* Fix test for request auth hiding AttributeErrors
* Re-raise/wrap auth attribute errors
* Fix test for py2k
* Add docs for WrappedAttributeError
2017-11-23 08:58:04 +01:00
Ryan P Kilby
a91361dd2f
Perform type check on passed request argument ( #5618 )
...
* Add test for wrapped request instance
* Add 'request' argument type check to Request init
* Fix metadata tests' request object
2017-11-23 08:57:31 +01:00
Ryan P Kilby
1a667f420d
Reimplement request attribute access w/ __getattr__ ( #5617 )
...
* Add tests for proxying WSGIRequest attributes in Request.
* Add request attribute exception test
* Reimplement request attribute access
2017-11-22 11:42:59 +01:00
Ryan P Kilby
9f66e8badd
Fix request body/POST access ( #5590 )
...
* Modernize middleware tests
* Added a failing test for #5582
* Set data ref on underlying django request
2017-11-15 20:58:37 +01:00
Ryan P Kilby
0ec915e623
Force content_type inclusion in APIRequestFactory
2017-08-31 05:45:12 -04:00
Tom Christie
6d4d4dfd04
Ensure closables in request.FILES get closed. ( #5262 )
...
Ensure closables on `.FILES` get closed.
2017-07-10 13:42:02 +01:00
Daniel Hahler
fe95ab675b
doc: fix documentation for Request._authenticate
...
It does not return anything.
2017-06-16 13:23:26 +02:00
Pavlin Gergov
eacb93d453
Update _not_authenticated's docstring ( #4906 )
2017-02-20 09:33:54 +00:00
Artem Muterko
4dd71d68d2
Remove extra parentheses ( #4789 )
2017-01-08 16:09:23 +00:00
Tom Christie
5677d063d8
Do not treat empty non-form input as HTML. ( #4566 )
2016-10-12 15:46:24 +01:00
Tom Christie
be74d11165
Fallback behavior for request parsing when request.POST already accessed. ( #4500 )
2016-09-21 11:49:09 +01:00
Tom Christie
382ea770b5
Improve debug error handling ( #4416 )
2016-08-18 14:42:15 +01:00
Tom Christie
101fd29039
Do not include uploads in request.POST ( #4407 )
2016-08-15 16:53:17 +01:00
Stephan Groß
a101251a2a
Fix blank lines around docstrings
2016-03-17 11:06:47 +00:00
Tom Christie
d587ad1021
Use REST framework request parsing when accessing old-style .POST
2015-11-04 14:10:51 +00:00
Tom Christie
4b4130e8b2
Fix request cloning, so method becomes set
2015-09-17 16:34:03 +01:00
Tom Christie
566812ac0b
Remove method and content overriding
2015-09-17 15:17:29 +01:00
Tom Christie
0df99a6c95
Fix erronous request.files docs, and incorrect request.FILES behavior. Closes #3261 .
2015-08-11 16:21:02 +01:00
Tom Christie
19c1976fcc
Leave requests.FILES alone, for compat with regular Django requests. Closes #3239 .
2015-08-07 14:24:28 +01:00
Tom Christie
f7d44dfae0
Loud errors on request.DATA et al.
2015-08-05 17:07:47 +01:00
Tom Christie
1b3b01e042
Remove unused imports
2015-07-30 15:59:27 +01:00
Tom Christie
c203ca4c64
Deprecations
2015-07-30 15:26:42 +01:00
José Padilla
7351a3f6ca
Sort imports with isort
2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90
Cleanup import following PEP 8 style guide
2015-06-25 16:10:17 -04:00
Alex Rothberg
a804d0bd75
set the action when override_method regardless of its None-ness
2015-05-13 22:53:32 -04:00
Egor Yurtaev
ce31e36973
Remove MergeDict
...
The class MergeDict is deprecated and will be removed in Django 1.9
2015-03-05 18:34:42 +06:00
Tom Christie
dbd2352165
Fixes for latest pep8 updates. Refs #2563 .
2015-02-17 10:58:00 +00:00
Tom Christie
fbb21caaaa
Merge master
2015-02-09 20:43:50 +00:00
Tom Christie
54d82f59ed
Py3 compat fix
2015-02-09 17:19:22 +00:00
Tom Christie
d13c807616
Fix misleading AttributeErrors
2015-02-09 17:02:54 +00:00
Tom Christie
1f99612845
Upgrade pending deprecations to deprecations
2015-02-06 13:21:35 +00:00
Brandon Cazander
ac87490b91
Clone the versioning_scheme when necessary. Fixes #2477
2015-01-27 17:10:17 -08:00
Brandon Cazander
bf58c1265d
Set a version attribute on cloned requests if necessary.
2015-01-26 22:56:57 -08:00
Brandon Cazander
ed04725822
Use enhanced request when cloning requests for checking permissions on other methods. Fixes #2455
2015-01-24 01:44:40 -08:00
Tom Christie
65fc0d0f77
Ensure request.auth is available to response middleware.
2014-12-17 13:22:52 +00:00
Tom Christie
7fbf5b0e6b
Merge pull request #2155 from martinmaillard/set-user-on-wrapped-request
...
Set authenticated user on wrapped request
2014-12-17 13:12:01 +00:00
Tymur Maryokhin
d54c67d79d
Removed custom StringIO, force_text, smart_text compat
2014-12-04 03:11:42 +01:00
Martin Maillard
85c96bb574
Set user on wrapped request
2014-11-28 21:12:27 +01:00
Tom Christie
2e726e22a3
request.DATA, request.FILES -> request.data
2014-11-25 11:42:43 +00:00
Tom Christie
2daf085100
Copy accepted_renderer and accepted_media_type when cloing a request. Closes #1950 .
2014-11-05 11:08:32 +00:00