add isbn10 and isbn13 validators to Edition model#3573
Conversation
ad1956e to
b8d4b62
Compare
|
Hello!, and thank you for your PR. Regarding unit tests:
I’ve pushed a branch with unit tests for your changes (diff can be seen here; I could create a PR if you’d like). Some of the tests are commented out, since they would fail with the current implementation. Starting with the least complex, these are:
|
|
Hi, Thanks for the test-examples and comments, those help a lot! Actually looking the models/book.py file, I could validate isbn10 by converting it to isbn13 and back and check result to match. For isbn13 similar should work if I just extend isbn13_to_10 also accept '979' prefix. But please open PR for those tests and I'll take them in and work on those failing cases you spotted. |
|
Realised that I can make the PR with your link directly, so took it in, thanks! |
mouse-reeve
left a comment
There was a problem hiding this comment.
If the ISBN 13 value showing the ISBN 10 message issue is complex to resolve, I think I reasonable solution would be just to always give the same generic error message. Otherwise this looks good!
Checks if isbns looks valid when manually editing book before it goes to database
… mismatch of checksum giving prefix in isbn-13 should make it move clear that we don't compare it to possible given isbn-10
688292c to
d18eea4
Compare
Description
Checks if isbns looks valid when manually editing book before it goes to database. This allows the form inform if isbn values look something else than what bookwyrm expects them to be.
What type of Pull Request is this?
Does this PR change settings or dependencies, or break something?
Details of breaking or configuration changes (if any of above checked)
Documentation
Tests