Developer Tools

Python Update Makes Web Forms More Predictable for Developers

Python Update Makes Web Forms More Predictable for Developers

⚑If you use websites with forms, this update could make them more reliable.

Deep Dive

Parameter models for query, header, cookie, and form parameters now apply their extra configuration to all submitted fields in the same parameter location, consistent with Pydantic behavior. This includes fields declared in other models, individual parameters, or dependencies, which were previously excluded.

With extra="forbid", fields outside the model are rejected even if another parameter declares them. With extra="allow", those fields are included as model extras. With the default extra="ignore", they are ignored.

Key Points
  • Settings for form fields now apply to all fields in the same location, like all query parameters.
  • This makes web forms more predictable and can improve security by consistently rejecting unexpected data.
  • Some existing websites might need updates to work with the new behavior.

Why It Matters

This update could lead to fewer errors and better security when you fill out online forms.

πŸ“¬ Get the top 10 AI stories daily