Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More descriptive errors for printing page rage #1717

Open
JasonGrace2282 opened this issue Sep 11, 2024 · 0 comments
Open

More descriptive errors for printing page rage #1717

JasonGrace2282 opened this issue Sep 11, 2024 · 0 comments

Comments

@JasonGrace2282
Copy link
Member

JasonGrace2282 commented Sep 11, 2024

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/

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

No branches or pull requests

1 participant