CodeVetter · Repo Unpack · Extension points
pallets/werkzeug
Extension primarily uses Python classes, factories, and WSGI callable composition. Routing offers explicit converter and rule-factory interfaces. Request parsing and JSON behavior can be overridden, although several historical hooks are being deprecated. Server, reloader, static-resource, and file-response factories expose additional integration seams.
- Custom route converters plug into Map(converters=...) or its instance registry; BaseConverter exposes regex, weight, part_isolating, to_python, and to_url.
- RuleFactory subclasses implement get_rules; Map.add binds every yielded rule, registers matchable rules with the matcher, and indexes all rules by endpoint.
- Subdomain and Submount compose nested rule factories by copying rules and modifying their subdomain or path prefix.
- Request._parse_form_data(stream) is the new parsing override point; form_data_parser_class, make_form_data_parser, and _get_file_stream remain compatibility hooks marked for Werkzeug 4.0 removal.
- Multipart parsing accepts a stream_factory that receives filename, content type, and length metadata; its returned writable stream owns uploaded bytes until FileStorage exposes them.
- Request JSON behavior delegates to json_module.loads and on_json_loading_failed; replacing these changes decoding or error handling while retaining force/silent/cache control.
- WSGI callable composition supports mounted applications through DispatcherMiddleware and static resource exports through SharedDataMiddleware; Shortly.create_app demonstrates swapping the wrapped wsgi_app.
- make_server accepts a custom request_handler; reloader selection uses the reloader_loops table, choosing stat or watchdog for auto; send_file accepts a response_class and callable max_age.