#36841: Add multipart_parser_class attribute to HttpRequest for pluggable
multipart
parsing
-------------------------------------+-------------------------------------
Reporter: Farhan | Owner: (none)
Ali |
Type: New | Status: assigned
feature |
Component: HTTP | Version: dev
handling |
Severity: Normal | Keywords: mutipart-parsing
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
== Problem
Django's `parse_file_upload()` hardcodes `MultiPartParser`, making it hard
to swap in faster implementations.
== Proposed Solution
As discussed with the steering council and Carlton Gibson on the forum:
1. Add `multipart_parser_class` class attribute to `HttpRequest`
(defaulting to `MultiPartParser`)
2. Modify `parse_file_upload()` to use `self.multipart_parser_class`
instead of direct import
3. Ensure uniform parser interface: `__init__(META, input_data,
upload_handlers, encoding)`
with `parse()` returning `(POST, FILES)`
== Usage
Users can subclass `HttpRequest` and override `multipart_parser_class` to
use
faster parsers.
== Benefits
- Immediate performance improvements for those who need them
- Stepping stone toward DEP 17 https://github.com/django/deps/pull/88
(pluggable content type parsers)
- Minimal change
- Follows proven pattern from Django REST Framework's `parser_classes`
== Forum Discussion
https://github.com/django/new-features/issues/105
--
Ticket URL: <https://code.djangoproject.com/ticket/36841>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019b8ef0fb81-0b833396-bec0-4fe2-85a8-75a248839163-000000%40eu-central-1.amazonses.com.