diff --git a/pagure/forms.py b/pagure/forms.py index 56b530e..9ac55d3 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -14,8 +14,8 @@ import wtforms # pylint: disable=R0903,W0232,E1002 -REGEX = '^[a-zA-Z0-9-_]+$' -REGEX2 = '^[a-zA-Z0-9 #]+$' +STRICT_REGEX = '^[a-zA-Z0-9-_]+$' +RELAXED_REGEX = '^[a-zA-Z0-9 #]+$' class ProjectFormSimplified(wtf.Form): @@ -40,7 +40,7 @@ class ProjectForm(ProjectFormSimplified): 'Project name *', [ wtforms.validators.Required(), - wtforms.validators.Regexp(REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) @@ -51,7 +51,7 @@ class IssueFormSimplied(wtf.Form): 'Title*', [ wtforms.validators.Required(), - wtforms.validators.Regexp(REGEX2, flags=re.IGNORECASE) + wtforms.validators.Regexp(RELAXED_REGEX, flags=re.IGNORECASE) ] ) issue_content = wtforms.TextAreaField( @@ -90,7 +90,7 @@ class RequestPullForm(wtf.Form): 'Title*', [ wtforms.validators.Required(), - wtforms.validators.Regexp(REGEX2, flags=re.IGNORECASE) + wtforms.validators.Regexp(RELAXED_REGEX, flags=re.IGNORECASE) ] ) @@ -101,7 +101,7 @@ class AddIssueTagForm(wtf.Form): 'tag', [ wtforms.validators.Optional(), - wtforms.validators.Regexp(REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) @@ -152,7 +152,7 @@ class UpdateIssueForm(wtf.Form): 'tag', [ wtforms.validators.Optional(), - wtforms.validators.Regexp(REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) depends = wtforms.TextField( @@ -233,7 +233,7 @@ class AddGroupForm(wtf.Form): 'Group *', [ wtforms.validators.Required(), - wtforms.validators.Regexp(REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) @@ -283,7 +283,7 @@ class NewGroupForm(wtf.Form): [ wtforms.validators.Required(), wtforms.validators.Length(max=16), - wtforms.validators.Regexp(REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(STRICT_REGEX, flags=re.IGNORECASE) ] ) group_type = wtforms.SelectField(