MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/http/request.py:593–622  ·  view source on GitHub ↗
(self, query_string=None, mutable=False, encoding=None)

Source from the content-addressed store, hash-verified

591 _encoding = None
592
593 def __init__(self, query_string=None, mutable=False, encoding=None):
594 super().__init__()
595 self.encoding = encoding or settings.DEFAULT_CHARSET
596 query_string = query_string or ""
597 parse_qsl_kwargs = {
598 "keep_blank_values": True,
599 "encoding": self.encoding,
600 "max_num_fields": settings.DATA_UPLOAD_MAX_NUMBER_FIELDS,
601 }
602 if isinstance(query_string, bytes):
603 # query_string normally contains URL-encoded data, a subset of
604 # ASCII.
605 try:
606 query_string = query_string.decode(self.encoding)
607 except UnicodeDecodeError:
608 # ... but some user agents are misbehaving :-(
609 query_string = query_string.decode("iso-8859-1")
610 try:
611 for key, value in parse_qsl(query_string, **parse_qsl_kwargs):
612 self.appendlist(key, value)
613 except ValueError as e:
614 # ValueError can also be raised if the strict_parsing argument to
615 # parse_qsl() is True. As that is not used by Django, assume that
616 # the exception was raised by exceeding the value of max_num_fields
617 # instead of fragile checks of exception message strings.
618 raise TooManyFieldsSent(
619 "The number of GET/POST parameters exceeded "
620 "settings.DATA_UPLOAD_MAX_NUMBER_FIELDS."
621 ) from e
622 self._mutable = mutable
623
624 @classmethod
625 def fromkeys(cls, iterable, value="", mutable=False, encoding=None):

Callers 1

__init__Method · 0.45

Calls 3

appendlistMethod · 0.95
TooManyFieldsSentClass · 0.90
decodeMethod · 0.45

Tested by

no test coverage detected