Repository navigation
Preserve Flask-WTF captcha classes in form macros - #425
Open
2836048681 wants to merge 1 commit into
Open
2836048681 wants to merge 1 commit into
2836048681 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #408.
Rendering a
RecaptchaFieldcurrently adds Bootstrap input classes such asform-control. With Flask-WTF 1.3.0, the widget treats this as an explicit class override, replacing theg-recaptchadefault or a configured class such ash-captcha. The captcha script then cannot find its target element.Render captcha widgets without adding Bootstrap input classes in the basic, inline, and horizontal layouts for both Bootstrap 4 and 5. Preserve explicit
class/class_arguments and fieldrender_kwclasses, while retaining the existing labels, layout containers, and validation feedback.Add 48 regression cases covering both Bootstrap versions, all three layouts,
render_field,render_form, andrender_form_row, default and configured classes, explicit class overrides, additional widget attributes, and validation errors. Update the macro documentation and changelog.Validation
Python 3.12.3 on Linux:
requirements/tests.txtunchanged (Flask-WTF 1.2.1, WTForms 3.1.2): 215 passed.python -m flake8 flask_bootstrap tests: passed.git diff --cached --check: passed.Two unrelated existing check failures were investigated:
test_class,test_class_inline, andtest_class_horizontal). The untouched base commit has the exact same three failures and 164 passes, before adding the 48 new cases. Both runs use Flask-WTF 1.3.0 and WTForms 3.3.2.input_customizationlabel. Building the complete base-commit source archive reproduces the same single warning. No documentation warning was introduced by this change.Rendering tests use a dummy public key and do not contact a captcha service or require private credentials. Other Python versions and operating systems were not tested locally.