Skip to content

Fixed ListField empty check which ignored multi-part list elements #4763

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

Closed

Conversation

NeveHanter
Copy link

FIxed ListField empty check.

It was ignoring multi-part elements with parts like emails[0], emails[1] because previous check logic only checked if field name (in this example emails) was in dictionary which won't match indexed list declarations.

Copy link
Member

@tomchristie tomchristie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Could you include a test case that fails before this and passes after?

@NeveHanter
Copy link
Author

@tomchristie Done

regexp = re.compile(html.HTML_LIST_REGEXP_FORMAT % re.escape(self.field_name))
if not any(regexp.match(key) for key in dictionary.keys()):
return empty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not comfortable moving the empty check entirely inside is_html_input - seems like we might be missing some failure cases that introduces that aren't covered by our test cases.

Any way around we could arrange this PR that has a smaller change footprint?

@tomchristie tomchristie added this to the 3.5.4 Release milestone Jan 1, 2017
Copy link
Member

@tomchristie tomchristie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required: Determine if there's a way to achieve this behaviour but with a less invasive change footprint.

@carltongibson
Copy link
Collaborator

I'm going to de-milestone for now. We'll come back to this after v3.7

@carltongibson
Copy link
Collaborator

I'm going to close this in favour of #5927. Thanks for the effort @NeveHanter!

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.

3 participants