#15928 closed New feature (wontfix)
RegexField and regexp flags
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Forms | Version: | 1.3 |
| Severity: | Normal | Keywords: | RegexField unicode re.compile |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The syntax of re.compile function is:
regexp = re.compile(pattern[, flags])
but this function in RegexField used without flags. I suggest to use the next syntax for RegexField:
login = RegexField(r'\w+', flags=re.UNICODE|re.IGNORE)
I guess it will be useful. Thank you!
Change History (3)
comment:1 by , 15 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:2 by , 15 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Yes, you are right! I agree with you. Your examples are better. The extra parameter isn't need. Thank you!
I will close the ticket.
Note:
See TracTickets
for help on using tickets.
Based on the docs,
RegexField.regexis a "regular expression specified either as a string or a compiled regular expression object.".Your example could be written like this:
And also like this—it's slightly shorter but less readable:
IMO this is sufficient and it's not necessary to add a
flagsparameter toRegexField, but others may feel differently. I'll mark the ticket as DDN.