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

Fix line endings, various HidingContainer fixes, missing test deps, GrowingGridLayout validation #12

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

nphilipp
Copy link
Contributor

I originally planned this to fix HidingCheckBox, as it is it doesn't really work well for showing widgets if the checkbox is unchecked, probably due to the different nature of truth values in JS and Python. The rest came up when I tested things out:

  1. Some previous commit(s) converted widgets.py to DOS line endings. The first commit reverts that.

  2. In HidingContainerMixin._validate(), the wrong module was used for raising ValidationError, the second commit fixes this.

  3. Normalize HidingCheckBox.mapping keys if they are "well-known" truth values (True, "true", 1, False, "false", 0), so the JS mapping keys matches the checked status of the checkbox.

  4. Create a state object in HidingContainerMixin._validate().

  5. Allow users to submit forms with hidden fields that have the required attribute set: Assuming that a user can't fill in a form field that is hidden, "hide" the required attribute under a different name (and "reveal" it again if the field is unhidden).

Addendum (and because this builds on the lineending change):

  1. Add missing 'sieve' test dependency

  2. With a GrowingGridLayout, the first (hidden, template) child can cause validation to fail, e.g. if a field is marked as required. This change sets its validator member to None in order to skip validation for this child.

Necessary to hide stuff if the checkbox is unchecked. Allows using True
and False as keys in mappings.
@nphilipp nphilipp changed the title Unix linendings, fix raising ValidationError Unix lineendings, fix raising ValidationError Dec 17, 2015
Cf. this change in tw2.core:
1cdab8206dc0009209ff72e8e3f355ee8fa9b0ba MatchValidator broken due to CompoundWidget state
This is necessary so that users of HTML5-capable browsers can submit
forms with hidden form fields that have the `required` attribute set
(assuming hidden form fields cannot be required because users can't fill
them). Needs server-side validation logic to follow suit, i.e.
distinguish between hidden and non-hidden form fields depending on the
state of the hiding form field.
@nphilipp nphilipp changed the title Unix lineendings, fix raising ValidationError Unix lineendings, fix raising ValidationError, HidingCheckBox improvements, hide required attributes on hidden widgets Dec 21, 2015
@nphilipp nphilipp changed the title Unix lineendings, fix raising ValidationError, HidingCheckBox improvements, hide required attributes on hidden widgets Fix line endings, various HidingContainer fixes, missing test deps, GrowingGridLayout validation Mar 23, 2016
@nphilipp nphilipp changed the title Fix line endings, various HidingContainer fixes, missing test deps, GrowingGridLayout validation Fix line endings, various HidingContainer fixes, missing test deps, GrowingGridLayout validation Mar 23, 2016
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

Successfully merging this pull request may close these issues.

None yet

1 participant