Skip to content

Fix default errors for bates_number()#914

Open
BryceStevenWilley wants to merge 1 commit intojhpyle:masterfrom
SuffolkLITLab:bates_defaults
Open

Fix default errors for bates_number()#914
BryceStevenWilley wants to merge 1 commit intojhpyle:masterfrom
SuffolkLITLab:bates_defaults

Conversation

@BryceStevenWilley
Copy link
Contributor

@BryceStevenWilley BryceStevenWilley commented Mar 5, 2026

If any of the font_size, offset_horizontal, and offset_vertical params aren't given, then bates_number will error, because the default values for those params are given as None, which do not parse into floats on the bates.py side.

This patch changes the defaults in util.py to match the defaults in marisol.py: 15 for the offsets and 10 for the font size.

Also changes how the values are retrieved from kwargs, to prevent people from breaking the function by passing in Nones.

Introduced in #898.

Smallest program that'll fair in 1.9.2.

event: done
question: |
  Your document
subquestion: |
  ${ test_document }
---
mandatory: True
code: |
  test_document.bates_number()
  done
---
attachments:
  - variable name: test_document
    filename: test_document
    valid formats: [pdf]
    content: "[BOLDCENTER] A Test Document [BR]"

Fails with:

bates_number: failure during processing; return value 2 after /usr/share/docassemble/local3.12/bin/python -m docassemble.base.bates --prefix MI- --digits 3 --start 0 --area BOTTOM_LEFT --font-size 5 --offset-horizontal None --offset-vertical 250 /usr/share/docassemble/files/000/000/000/55c/file.pdf

If any of the `font_size`, `offset_horizontal`, and `offset_vertical`
params aren't given, then `bates_number` will error, because the default
values for those params are given as `None`, which do not parse into `floats`
on the `bates.py` side.

This patch changes the defaults in `util.py` to match the defaults in
`marisol.py`: 15 for the offsets and 10 for the font size.

Also changes how the values are retrieved from `kwargs`, to prevent people
from breaking the function by passing in `None`s.
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