Skip to content

Fixed #37257 -- Prevented spurious double-dot deprecation warnings. - #21747

Open
adamchainz wants to merge 1 commit into
django:mainfrom
adamchainz:ticket_37257
Open

Fixed #37257 -- Prevented spurious double-dot deprecation warnings.#21747
adamchainz wants to merge 1 commit into
django:mainfrom
adamchainz:ticket_37257

Conversation

@adamchainz

Copy link
Copy Markdown
Member

Trac ticket number

ticket-37257

Branch description

The deprecation warning for double-dot variable lookups checked str(filter_expression.var), which for constants is the resolved literal value rather than a lookup expression. Templates containing string, translated, or numeric literals with two consecutive dots, such as {{ "a..b" }} or {{ 'a..b'|upper }}, therefore emitted a spurious RemovedInDjango70Warning even though no variable lookup was involved, breaking test suites run with -W error and putting valid templates on track to become hard errors in Django 7.0. The check now only fires when the filter expression's variable is an actual Variable lookup.

Regression in 5d911f2.

AI Assistance Disclosure (REQUIRED)

  • No AI tools were used in preparing this PR.
  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.

Claude 5 Fable did nearly all the work here, discovering the bug and writing the commit. I made minor edits. I agree with the report and approach.

Checklist

  • This PR follows the contribution guidelines.
  • This PR does not disclose a security vulnerability (see vulnerability reporting).
  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number (if applicable), and ends with a period (see guidelines).
  • I have not requested, and will not request, an automated AI review for this PR.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

The deprecation warning for double-dot variable lookups checked
`str(filter_expression.var)`, which for constants is the resolved literal
value rather than a lookup expression. Templates containing string,
translated, or numeric literals with two consecutive dots, such as
`{{ "a..b" }}` or `{{ 'a..b'|upper }}`, therefore emitted a spurious
`RemovedInDjango70Warning` even though no variable lookup was involved,
breaking test suites run with -W error and putting valid templates on
track to become hard errors in Django 7.0. The check now only fires when
the filter expression's variable is an actual Variable lookup.

Regression in 5d911f2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant