-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Non boolean values for field_flags #467
Conversation
I haven't written any documentation yet. Also this could probably use some more tests. And ideally the |
@davidism the stylecheck fails because some lines are too long (> 80 characters). The docs say this is not a hard limit and I see other lines in |
I believe Flake8 is configure to allow what Black allows: 88 characters max. Literals should be split with implicit continuations: value = (
"This is a"
" long sentance."
) |
For some reason coveralls fails. I don't think this is an issue with my code. |
Ok, it seems the coveralls API failed. Simply restarting the job worked… Can you have a look at the code now @davidism and tell me any issues? If everything is ok code wise, I'll write some documentation. |
When we have time, I or another maintainer will handle this. |
Thank you! I just wanted to make sure this is still on your radar. |
@Sohalt I've been afk for a bit on this project 😞, so could you tell me why you chose to go with a function call rather than a property/attribute of sorts? |
It's been a while, so I don't exactly remember the reason. But I think if I remember correctly I originally tried implementing it with a dictionary, which failed however for my specific use case. I think using the lambda was required to delay evaluation, because some information was not yet available when setting the flags. |
I switched the tests to the pytest syntax and rebased this branch. I can understand the use of Then with some documentation I think this PR would look good. |
26acfbf
to
d550f05
Compare
This seems good to me now. However I don't know if this patch should target |
if isinstance(flags, tuple): | ||
warnings.warn( | ||
"Flags should be stored in dicts and not in tuples. " | ||
"The next version of WTForms will abandon support " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on which branch this PR lands, we should explicit the next version
.
This allows to specify a function returning a dictionary for field_flags.
This allows validators to set flags which are supported directly in HTML for client side validation, such as
minlength
, which then get rendered appropriately by the widgets supporting that attribute.Fixes #406