Use black for formatting

This commit is contained in:
richard-dds
2018-06-26 10:31:39 -04:00
parent 3599440ee6
commit f9335c7a4e
28 changed files with 362 additions and 255 deletions

View File

@@ -2,7 +2,8 @@ from wtforms.fields.html5 import IntegerField
from wtforms.validators import Required, ValidationError
from wtforms_tornado import Form
class DateForm(Form):
month = IntegerField('Month', validators=[Required()])
day = IntegerField('Day', validators=[Required()])
year = IntegerField('Year', validators=[Required()])
month = IntegerField("Month", validators=[Required()])
day = IntegerField("Day", validators=[Required()])
year = IntegerField("Year", validators=[Required()])

View File

@@ -1,4 +1,5 @@
from wtforms_tornado import Form
class FundingForm(Form):
pass

View File

@@ -1,4 +1,5 @@
from wtforms_tornado import Form
class OrganizationInfoForm(Form):
pass

View File

@@ -1,4 +1,5 @@
from wtforms_tornado import Form
class ReadinessForm(Form):
pass

View File

@@ -1,44 +1,73 @@
from wtforms.fields.html5 import IntegerField
from wtforms.fields import RadioField, StringField, SelectField, TextAreaField, FormField
from wtforms.fields import (
RadioField,
StringField,
SelectField,
TextAreaField,
FormField,
)
from wtforms.validators import Required, ValidationError
from wtforms_tornado import Form
from .date import DateForm
class RequestForm(Form):
application_name = StringField('Application name', validators=[Required()])
application_description = TextAreaField('Application description', validators=[Required()])
dollar_value = IntegerField('Estimated dollar value of use', validators=[Required()])
input_estimate = SelectField('How did you arrive at this estimate?', validators=[Required()],
choices=[('','- Select -'),
('calculator','CSP usage calculator'),
('B','Option B'),
('C','Option C') ])
application_name = StringField("Application name", validators=[Required()])
application_description = TextAreaField(
"Application description", validators=[Required()]
)
dollar_value = IntegerField(
"Estimated dollar value of use", validators=[Required()]
)
input_estimate = SelectField(
"How did you arrive at this estimate?",
validators=[Required()],
choices=[
("", "- Select -"),
("calculator", "CSP usage calculator"),
("B", "Option B"),
("C", "Option C"),
],
)
# no way to apply a label to a whole nested form like this
date_start = FormField(DateForm)
period_of_performance = SelectField('Desired period of performance', validators=[Required()],
choices=[('','- Select -'),
('value1','30 days'),
('value2','60 days'),
('value3','90 days') ])
classification_level = RadioField('Classification level', validators=[Required()],
choices=[('unclassified', 'Unclassified'),
('secret', 'Secret'),
('top-secret', 'Top Secret') ])
primary_service_branch = StringField('Primary service branch usage', validators=[Required()])
cloud_model = RadioField('Cloud model service', validators=[Required()],
choices=[('iaas', 'IaaS'),
('paas', 'PaaS'),
('both', 'Both') ])
number_of_cores = IntegerField('Number of cores', validators=[Required()])
total_ram = IntegerField('Total RAM', validators=[Required()])
object_storage = IntegerField('Total object storage', validators=[Required()])
server_storage = IntegerField('Total server storage', validators=[Required()])
total_active_users = IntegerField('Total active users', validators=[Required()])
total_peak_users = IntegerField('Total peak users', validators=[Required()])
total_requests = IntegerField('Total requests', validators=[Required()])
total_environments = IntegerField('Total environments', validators=[Required()])
period_of_performance = SelectField(
"Desired period of performance",
validators=[Required()],
choices=[
("", "- Select -"),
("value1", "30 days"),
("value2", "60 days"),
("value3", "90 days"),
],
)
classification_level = RadioField(
"Classification level",
validators=[Required()],
choices=[
("unclassified", "Unclassified"),
("secret", "Secret"),
("top-secret", "Top Secret"),
],
)
primary_service_branch = StringField(
"Primary service branch usage", validators=[Required()]
)
cloud_model = RadioField(
"Cloud model service",
validators=[Required()],
choices=[("iaas", "IaaS"), ("paas", "PaaS"), ("both", "Both")],
)
number_of_cores = IntegerField("Number of cores", validators=[Required()])
total_ram = IntegerField("Total RAM", validators=[Required()])
object_storage = IntegerField("Total object storage", validators=[Required()])
server_storage = IntegerField("Total server storage", validators=[Required()])
total_active_users = IntegerField("Total active users", validators=[Required()])
total_peak_users = IntegerField("Total peak users", validators=[Required()])
total_requests = IntegerField("Total requests", validators=[Required()])
total_environments = IntegerField("Total environments", validators=[Required()])
# this is just an example validation; obviously this is wrong.
def validate_total_ram(self,field):
def validate_total_ram(self, field):
if (field.data % 2) != 0:
raise ValidationError("RAM must be in increments of 2.")

View File

@@ -1,4 +1,5 @@
from wtforms_tornado import Form
class ReviewForm(Form):
pass