hjwp / Book-TDD-Web-Dev-Python

Book - TDD web dev with Python
https://www.obeythetestinggoat.com
Other
484 stars 175 forks source link

update chapter 14 #244

Closed Xronophobe closed 4 months ago

Xronophobe commented 4 months ago

This chapter gave me some unforeseen amount of work when I noticed the test output right before "Using the Form in a View That Takes POST Requests" introduced the issue of the disappearing input box, but then the text started fixing the validation errors.

Initially I made several failed attempts trying to fix this by reordering the sections so that fixing the input box goes first and then the validation. However, all of these attempts resulted in a largely changed chapter, removed failures and errors mentioned in the book, and introduced new ones. Overall, I decided to just change the cited test output instead, as in fact, it did list the validation errors as well, beside the disappearing input box. Ideally I would deal with fixing the form first (just as the test output originally cited) and only then with fixing the validation, but this chapter is already delayed and I didn't want to change too many things.

Additionally, I would note that the EMPTY_ITEM_ERROR is currently dead code. It certainly is nice to have custom error messages, but the browser's built-in HTML5 validation for required elements already prevents the user from reaching the application state where we would display the error. I tried removing it, but once again, too many things would have changed. Maybe, at the end of the chapter we could add a new section introducing the concept of dead code and then it would remove the unused validation error text.

hjwp commented 4 months ago

Thanks Csanad! I do think it might be worth having another go at reordering the chapter someday. but this is a definite improvement, and i don't think it needs to be a blocker for release.

can we leave a TODO somewhere re: our ideas for reordering?

Xronophobe commented 4 months ago

yeah, absolutely! in fact, I'll open a new PR because I just noticed two more things I missed