Skip to content

More descriptive errors for printing page rage #1717

Open
@JasonGrace2282

Description

@JasonGrace2282

Topic of discussion

The page range option on the Ion printing page does not clearly describe the possible ways to represent the range.
For example, it might be intuitive for some people that to get the first 3 pages the page range might be 0-3, but pages
aren't zero indexed. Furthuremore, Ion only gives the vague error message of an invalid page range, which doesn't tell the user if it was a parsing issue, or an out of bounds issue, or something else.

Proposed options/solutions

Rewrite check_page_range

def check_page_range(page_range: str, max_pages: int) -> Optional[int]:

to return more descriptive errors (instead of returning None), and maybe add a help_text for the page range option.

Whatever behavior is added/changed should also be tested thoroughly.

Personal opinion (if applicable)

This is probably a good first issue for contributors.

It also might be worth considering making the check_page_range function a form field validator and/or overriding Form.clean - see https://docs.djangoproject.com/en/4.2/ref/forms/validation/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions