-
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 #50 from GSA/flask-routes
add Flask routes
- Loading branch information
Showing
22 changed files
with
1,078 additions
and
413 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField, SubmitField, SelectField, TextAreaField | ||
from wtforms.validators import DataRequired, URL, ValidationError | ||
import re | ||
|
||
def validate_email_list(form, field): | ||
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') | ||
|
||
class OrganizationForm(FlaskForm): | ||
name = StringField('Name', validators=[DataRequired()]) | ||
logo = StringField('Logo', validators=[DataRequired()]) | ||
submit = SubmitField('Submit') |
Oops, something went wrong.
8bdcbdc
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
8bdcbdc
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