-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
32 lines (20 loc) · 923 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField, SelectField
from wtforms.validators import DataRequired, ValidationError
import os
validInputSubstring = 'github'
def CheckInput(form, field):
if validInputSubstring not in field.data and not os.path.isdir(field.data):
raise ValidationError('Input is not valid!')
class InputRepoForm(FlaskForm):
input = StringField('Repository Path:',
validators=[DataRequired(), CheckInput])
select = SelectField('Select:',
choices=[('single', 'Single Commit'), ('fromTo', 'Between Commits'),
("sinceTo", "SinceTo")])
commit1 = StringField('Commit1 :')
commit2 = StringField('Commit 2:')
date1 = StringField("Since")
date2 = StringField("To")
submit = SubmitField("Start")
output = TextAreaField('Output')