Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Simplify form validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Aug 26, 2015
1 parent 04a6f39 commit cdfae02
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions onegov/form/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from mimetypes import types_map
from stdnum.exceptions import ValidationError as StdnumValidationError
from wtforms import ValidationError
from wtforms.fields.html5 import EmailField


class Stdnum(object):
Expand Down Expand Up @@ -122,11 +121,5 @@ def __call__(self, form, field):
raise ValidationError(field.gettext(self.message))
else:
if self.require_email_field:
matches = form.match_fields(
include_classes=(EmailField, ),
required=True,
limit=1
)

if not matches:
if not form.has_required_email_field:
raise ValidationError(field.gettext(self.email))

0 comments on commit cdfae02

Please sign in to comment.