Conversation
…uper() The condition_dict caching added in 2.6 stores its memo on the _resolved_form_list and _cache_signature attributes, which are only ever set by the default WizardView.get_form_list(). WizardView.post() cleared that memo with bare del statements, so a wizard that overrides get_form_list() without delegating to super() raised AttributeError and returned HTTP 500 on every successful step submission. Overriding get_form_list() is a supported extension point, and the test suite already ships TestWizardWithCustomGetFormList for it, but the existing test only issues a GET, so the crash went unnoticed. Discard the caches only if they were set, matching the hasattr() guard the reader already uses, and add a POST regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
A wizard that overrides
get_form_list()without callingsuper()raisesAttributeErrorand returns HTTP 500 on every successful step submission:Overriding
get_form_list()is a supported extension point — the test suite already shipsTestWizardWithCustomGetFormListfor exactly this pattern:The wizard renders fine on GET, but is unusable end-to-end: submitting step 1 crashes instead of advancing.
Root cause
The
condition_dictcaching added in 2.6 (#291) memoises on two attributes:These are set only by the default
WizardView.get_form_list().post()then invalidates them with baredelstatements, which raise when the attributes were never created:The reader a few lines up already anticipates their absence:
so the guard is simply missing on the invalidation side. This is a regression against 2.5.1, where
post()had no cache-clearing code.test_get_form_list_customonly issues a GET, which is why the suite stayed green.The fix
Discard the caches only if they were set, matching the
hasattr()guard the reader already uses. No behaviour change on the default path.Tests
Added
test_get_form_list_custom_post, a POST counterpart to the existing GET-onlytest_get_form_list_custom. It fails onmasterwith theAttributeErrorabove and passes with the fix.Full suite: 100 passing before, 101 passing after.
🤖 Generated with Claude Code