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.
- Converted HeadersCheckMixin to MailTestsMixin for all shared helpers:
- Hoisted assertStartsWith() from BaseEmailBackendTests.
- Added matching assertEndsWith().
- Hoisted get_decoded_attachments() from MailTests.
- Improved failure reporting in assertMessageHasHeaders().
- Used unittest subTest() to improve handling of compound test cases.
- Replaced `assertTrue(test on string)` with custom assertions,
so that failure reporting is more informative than `True != False`.