-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from GSA/lint-fixes
lints all files
- Loading branch information
Showing
19 changed files
with
427 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField, SubmitField, SelectField, TextAreaField | ||
from wtforms.validators import DataRequired, URL, ValidationError | ||
import re | ||
|
||
from flask_wtf import FlaskForm | ||
from wtforms import SelectField, StringField, SubmitField, TextAreaField | ||
from wtforms.validators import URL, DataRequired, ValidationError | ||
|
||
|
||
def validate_email_list(form, field): | ||
emails = field.data.split(',') | ||
emails = field.data.split(",") | ||
for email in emails: | ||
if not re.match(r"[^@]+@[^@]+\.[^@]+", email.strip()): | ||
raise ValidationError("Invalid email address: {}".format(email)) | ||
|
||
|
||
|
||
class HarvestSourceForm(FlaskForm): | ||
organization_id = SelectField('Organization', | ||
choices=[], validators=[DataRequired()]) | ||
name = StringField('Name', validators=[DataRequired()]) | ||
url = StringField('URL', validators=[DataRequired(), URL()]) | ||
emails = TextAreaField('Notification_emails', | ||
validators=[DataRequired(), validate_email_list]) | ||
frequency = SelectField('Frequency', | ||
choices=['Manual', 'Daily', 'Weekly', 'Biweekly','Monthly'], | ||
validators=[DataRequired()]) | ||
user_requested_frequency = StringField('User_requested_frequency', | ||
validators=[DataRequired()]) | ||
schema_type = SelectField('Schema Type', | ||
choices=['strict', 'other'], | ||
validators=[DataRequired()]) | ||
source_type = SelectField('Source Type', | ||
choices=['Datajson', 'WAF'], | ||
validators=[DataRequired()]) | ||
submit = SubmitField('Submit') | ||
organization_id = SelectField( | ||
"Organization", choices=[], validators=[DataRequired()] | ||
) | ||
name = StringField("Name", validators=[DataRequired()]) | ||
url = StringField("URL", validators=[DataRequired(), URL()]) | ||
emails = TextAreaField( | ||
"Notification_emails", validators=[DataRequired(), validate_email_list] | ||
) | ||
frequency = SelectField( | ||
"Frequency", | ||
choices=["Manual", "Daily", "Weekly", "Biweekly", "Monthly"], | ||
validators=[DataRequired()], | ||
) | ||
user_requested_frequency = StringField( | ||
"User_requested_frequency", validators=[DataRequired()] | ||
) | ||
schema_type = SelectField( | ||
"Schema Type", choices=["strict", "other"], validators=[DataRequired()] | ||
) | ||
source_type = SelectField( | ||
"Source Type", choices=["Datajson", "WAF"], validators=[DataRequired()] | ||
) | ||
submit = SubmitField("Submit") | ||
|
||
|
||
class OrganizationForm(FlaskForm): | ||
name = StringField('Name', validators=[DataRequired()]) | ||
logo = StringField('Logo', validators=[DataRequired()]) | ||
submit = SubmitField('Submit') | ||
name = StringField("Name", validators=[DataRequired()]) | ||
logo = StringField("Logo", validators=[DataRequired()]) | ||
submit = SubmitField("Submit") |
Oops, something went wrong.
f695fd5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report