MCPcopy
hub / github.com/pallets/werkzeug / _load_form_data

Method _load_form_data

src/werkzeug/wrappers/request.py:256–287  ·  view source on GitHub ↗

Method used internally to retrieve submitted data. After calling this sets `form` and `files` on the request object to multi dicts filled with the incoming form data. As a matter of fact the input stream will be empty afterwards. You can also call this method to fo

(self)

Source from the content-addressed store, hash-verified

254 )
255
256 def _load_form_data(self) -> None:
257 """Method used internally to retrieve submitted data. After calling
258 this sets `form` and `files` on the request object to multi dicts
259 filled with the incoming form data. As a matter of fact the input
260 stream will be empty afterwards. You can also call this method to
261 force the parsing of the form data.
262
263 .. versionadded:: 0.8
264 """
265 # abort early if we have already consumed the stream
266 if "form" in self.__dict__:
267 return
268
269 if self.want_form_data_parsed:
270 parser = self.make_form_data_parser()
271 data = parser.parse(
272 self._get_stream_for_parsing(),
273 self.mimetype,
274 self.content_length,
275 self.mimetype_params,
276 )
277 else:
278 data = (
279 self.stream,
280 self.parameter_storage_class(),
281 self.parameter_storage_class(),
282 )
283
284 # inject the values into the instance dict so that we bypass
285 # our cached_property non-data descriptor.
286 d = self.__dict__
287 d["stream"], d["form"], d["files"] = data
288
289 def _get_stream_for_parsing(self) -> t.IO[bytes]:
290 """This is the same as accessing :attr:`stream` with the difference

Callers 4

get_dataMethod · 0.95
formMethod · 0.95
filesMethod · 0.95
test_wrapper_internalsFunction · 0.80

Calls 3

make_form_data_parserMethod · 0.95
parseMethod · 0.45

Tested by 1

test_wrapper_internalsFunction · 0.64