Skip to content

fix(exports): convert bool values for SAV exports#3102

Merged
ukanga merged 1 commit into
mainfrom
fix-sav-export-bool-values
Jun 2, 2026
Merged

fix(exports): convert bool values for SAV exports#3102
ukanga merged 1 commit into
mainfrom
fix-sav-export-bool-values

Conversation

@ukanga
Copy link
Copy Markdown
Member

@ukanga ukanga commented Jun 2, 2026

Changes / Features implemented

  • Fixed SAV export generation when a string/text field contains a boolean value.
  • Updated encodeifstr() so SAV export values are consistently converted to strings before being passed to savReaderWriter.
  • Added regression coverage for boolean values in SAV exports.

Steps taken to verify this change does what is intended

  • Confirmed the regression test fails before the fix with:

    text
    AttributeError: 'bool' object has no attribute 'ljust'

  • Confirmed the targeted tests pass after the fix:

    python manage.py test \
      onadata.libs.tests.utils.testexporttools.TestExportTools.testencodeifstr \
      onadata.libs.tests.utils.testexportbuilder.TestExportBuilder.testzippedsavexportwithboolstringvalue \
      --settings=onadata.settings.githubactionstest

Side effects of implementing this change

  • Boolean values in SAV string fields are now exported as "True" / "False" instead of being passed as raw Python booleans.
  • No expected side effects for non-SAV exports.

Before submitting this PR for review, please make sure you have:

  • Included tests
  • Updated documentation

Closes #3082


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@ukanga ukanga force-pushed the fix-sav-export-bool-values branch from 6794203 to 68b5de7 Compare June 2, 2026 10:14
@ukanga ukanga force-pushed the fix-sav-export-bool-values branch from 68b5de7 to 55e4c2f Compare June 2, 2026 12:12
@ukanga ukanga merged commit 7eebdd4 into main Jun 2, 2026
11 checks passed
@ukanga ukanga deleted the fix-sav-export-bool-values branch June 2, 2026 13:43
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.

AttributeError: 'bool' object has no attribute 'ljust'

2 participants