Given there are no longer any internal usages of serialize=True and it poses
a risk to non-test databases integrity it seems appropriate to deprecate it.
While the top-level objects fed to serialization are bound to the test database
being created nothing prevents code invoked during serialization from
performing queries against other connections entries that haven't been swapped
yet.
The reported example of that is a database router directing all reads to a test
mirror for a set of models involving auto-created many-to-many fields. It might
be tempting to address the many-to-many field case but this a symptom of a
larger problem where the test framework yields the flow execution to user code
that could interact with non-test databases in unexpected ways.
Deferring test database fixture serialization until the point where all
connections entries have been swapped for their test equivalent ensures that no
code triggered during serialization can interact with non-test databases.
Thanks Jake Howard for the report and Jacob Walls for the initial
investigation.
Urlizer was not properly encoding email addresses containing punctuation
in generated mailto links. Per RFC 6068, fixed by percent encoding
(urllib.parse.quote) the local and domain address parts.
While AlterUniqueTogether has been documented to be still allowed in historical
migrations for the foreseeable future it has been crashing since 2abf417c81
was merged because the latter removed support for Meta.index_together which the
migration framework uses to render models to perform schema changes.
CreateModel(options["unique_together"]) was also affected.
Refs #27236.
Co-authored-by: Simon Charette <charette.s@gmail.com>
The "Trivial case failed. Try for possible IDN domain" handling was
obsoleted by ticket-20003, which adjusted the regular expressions to
allow all international domain names (Refs #20003).
Uses of `ul` were moved to DomainNameValidator in ticket-18119
(Refs #18119).
Test a domain that is valid under IDNA 2008 but not IDNA 2003. This
helps verify that the branch in URLValidator which calls punycode() is
not actually being used for IDNs. punycode() implements IDNA 2003, so
the domain would fail to validate if that branch were active for IDNs.
Before, the full suite of system checks was run by these commands
regardless if requires_system_checks had been overridden.
Co-authored-by: Simon Charette <charette.s@gmail.com>
This should make bulk_create significantly faster on Postgres when provided
only literal values.
Thanks James Sewell for writing about this technique, Tom Forbes for
validating the performance benefits, David Sanders and Mariusz Felisiak
for the review.
By building the list of placeholders for each inserted fields once it
doesn't have to be looked up for each inserted rows twice.
The query_values_10000.benchmark.QueryValues10000.time_query_values_10000 ASV
benchmark showed a 5% speed up for 10k items on SQLite for a single field
insertion. Larger performance gains are expected when more fields are involved.
- Used modern email API (policy.default) for tests that reparse
generated messages, and switched to modern accessors where helpful.
- Split get_raw_attachments() helper out of get_decoded_attachments(),
and used modern iter_attachments() to avoid finding nested attachments
in attached message/* emails.
- Stopped using legacy parseaddr.