-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Stronger check on blocks names #6295
Conversation
Manage this branch in SquashTest this branch here: https://fpoulainstricter-block-check-n-8aytm.squash.io |
6ff9555
to
3821d76
Compare
Thanks for this, I lost yesterday so much time because I didn't read the docs carefully and have defined the name with brackets: |
Thanks @fpoulain! Code looks good to me. I think this should be an error, not just a warning. There's at least one place in the design of StreamField where the block name needs to be a valid Python identifier - namely, being able to write |
Ok I will change this. What about the redondancy of the errors? The first check (name empty) could be left as is but the others (dash/space/numeric) could be removed since they are covered by my check. |
The redundancy of the checks did cross my mind, but it's probably a good thing that the more common mistakes (using spaces / dashes) give you a more focused error message telling you exactly what to change, rather than just "you must follow this format". So, I think this can stay as it is 👍 |
3821d76
to
9bc52ef
Compare
Ok. I updated the PR. I let you commit the changelog because my english is too approximative. Moreover, since it will breaks code for some users which --like me-- didn't read carefully the docs, imho this change should be told in the release notes. |
9bc52ef
to
a50a1ac
Compare
Merged in 0c68159. |
Ref: wagtail-deprecated/wagtail-react-streamfield#54
This PR stronger check on block names as stated in the docs.
Since it may break existing code I made use of a warning rather than an error. Let me know how do you think about it.
Maybe only in a second phase it should become a strong error and could replace others name checks.
Thanks for Wagtail! 🎉