Opened 6 years ago

Last modified 6 years ago

#13473 closed enhancement

Allow regex to allow empty fields — at Initial Version

Reported by: jsnell@… Owned by:
Priority: normal Component: TracTicketValidatorPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

This diff will allow the regex to allow for an empty field or a match.

Then, if a value is always required a rule with .+ instead of .* could be used instead.

Index: ticketvalidator.py =================================================================== --- ticketvalidator.py (revision 17283) +++ ticketvalidator.py (working copy) @@ -82,7 +82,7 @@

fieldValue = req.args.get(field)

if fieldValue is not None:

  • if not fieldValue or (rule and re.match(rule, fieldValue) is None):

+ if (rule and re.match(rule, fieldValue) is None):

return errorMessage

def _isValidateEmail(self, email):

Change History (0)

Note: See TracTickets for help on using tickets.