You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that check_email() currently has an allow_none argument, but I'm not sure how useful it is in practice. When using input.text() for email inputs, an empty input returns an empty string (""), not None. This means that even with allow_none=True, the validator won't allow blank emails. For example:
Suggestion
Altering or renaming allow_none would introduce breaking changes, even though it seems unlikely that users actually rely on this argument for email validation unless they're using check_email() for other purposes where None values are actually possible. Still, it may be preferable to add a new argument, such as allow_empty or allow_blank, to handle empty strings specifically.
Happy to submit a PR.
The text was updated successfully, but these errors were encountered:
I think allow_none is an R -> Python translation of allow_na (in R). We should probably keep it for API stability, so I'm entirely in favor of adding a new argument.
I like allow_empty, but there is some ambiguity – does it mean an empty string or an empty list/tuple/dict? Maybe the distinction isn't important, but the presence of allow_multiple makes it a little confusing. OTOH, allow_empty_string seems overly verbose, so I'd be okay with allow_empty.
That said, for both check.email() and check.url(), it seems that we could just implement a minimum character length before the check kicks in. I'd personally rather separate concerns and have check.required() handle the empty string case and have check.url() start only when the value is present. (Which relates to your other issue #13)
Thank you for this great package!
I noticed that
check_email()
currently has anallow_none
argument, but I'm not sure how useful it is in practice. When usinginput.text()
for email inputs, an empty input returns an empty string (""
), notNone
. This means that even withallow_none=True
, the validator won't allow blank emails. For example:shinylive link
Suggestion
Altering or renaming
allow_none
would introduce breaking changes, even though it seems unlikely that users actually rely on this argument for email validation unless they're usingcheck_email()
for other purposes whereNone
values are actually possible. Still, it may be preferable to add a new argument, such asallow_empty
orallow_blank
, to handle empty strings specifically.Happy to submit a PR.
The text was updated successfully, but these errors were encountered: