Fix AttributeError when 'main page title url opens in other window' is boolean - #983
Closed
jacobyoby wants to merge 1 commit into
Closed
Fix AttributeError when 'main page title url opens in other window' is boolean#983jacobyoby wants to merge 1 commit into
jacobyoby wants to merge 1 commit into
Conversation
…boolean When `main page title url opens in other window` is set to a YAML boolean (e.g. `False`), the default_title initialization in Interview.__init__ called `.strip()` on the bool value, raising `AttributeError: 'bool' object has no attribute 'strip'`. Wrap the value with `str()` before `.strip()`, consistent with how the same loop already handles metadata values on the lines above (lines 8441, 8443). The downstream consumer in helpers.py already compares via `str(status.title_url_opens_in_other_window) == 'False'`, so the string representation flows through correctly. Fixes jhpyle#980
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.
Summary
Fixes #980
When
main page title url opens in other windowis set to a YAML boolean (FalseorTrue) in the configuration, docassemble crashes with:The workaround was to quote the value as a string (
"False"), but booleans should work since YAML naturally parses unquotedFalse/Trueas booleans.Root cause
In
docassemble_base/docassemble/base/parse.py, thedefault_titleinitialization loop processesmain page *config values and calls.strip()directly on the value without converting to string first:False != ''evaluates toTrue, so the code enters the block and callsFalse.strip()→ crash.Fix
Wrap with
str()before.strip(), matching the pattern already used on lines 8441 and 8443 in the same loop for metadata values:The downstream consumer in
helpers.py:1207already compares viastr(status.title_url_opens_in_other_window) == 'False', so the string representation flows through correctly.Verified behavior
False(bool)"False"→ title opens in same window ✓True(bool)"True"→ title opens in new window ✓"False"(string, existing workaround)"False"→ same window ✓""(empty string)