Skip to content

[codex] Support docassemble 1.10 session APIs#1075

Draft
nonprofittechy wants to merge 4 commits into
mainfrom
backwards-compatible-v110
Draft

[codex] Support docassemble 1.10 session APIs#1075
nonprofittechy wants to merge 4 commits into
mainfrom
backwards-compatible-v110

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

Closes #1074.

What changed

  • Use docassemble.base.hooks.write_answer_json on docassemble 1.10 while retaining a dynamic fallback to the legacy server.write_answer_json hook.
  • Use docassemble.webapp.db.get_session() for every read query.
  • Use transactional docassemble.webapp.db.session_scope() for every delete/update query, including the advisory-lock metadata upsert.
  • Retain backwards compatibility with docassemble < 1.10 through the legacy engine's connect() and begin() context managers.

Root cause

Docassemble 1.10 removed both docassemble.webapp.db_object and the docassemble.base.functions.server object. The original issue identified three database call sites, but sessions.py contained six database context blocks; this updates all of them so no legacy engine access remains on the v1.10 path.

Impact

Importing docassemble.AssemblyLine.sessions works with docassemble 1.10 without dropping support for older installations. Read behavior is unchanged, while writes now use an explicit transaction in both compatibility paths.

Validation

  • black --check docassemble/AssemblyLine
  • mypy docassemble/AssemblyLine --config-file pyproject.toml
  • python -m compileall -q docassemble/AssemblyLine
  • Built sdist and wheel with python -m build
  • Import smoke test with installed docassemble 1.9.2 selected the legacy fallbacks
  • Import smoke test with the docassemble 1.10.1 source selected docassemble.webapp.db and docassemble.base.hooks

Database operations themselves still require validation in a running docassemble app/database context.

@nonprofittechy

Copy link
Copy Markdown
Member Author

Going to try locally running v1.10 DA and run kiln against both this and the ALToolbox PR as a baseline.

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.

Replace removed docassemble.webapp.db_object import for docassemble 1.10.0

1 participant