Fixed a double error bug
This commit is contained in:
+2
-3
@@ -6,8 +6,7 @@ from wtforms.validators import DataRequired, Length
|
|||||||
def validate_URL(form, field):
|
def validate_URL(form, field):
|
||||||
# Make sure the url is not too short or long
|
# Make sure the url is not too short or long
|
||||||
if len(field.data) < 4 or len(field.data) > 2000:
|
if len(field.data) < 4 or len(field.data) > 2000:
|
||||||
# Raise a ValidationError
|
return
|
||||||
raise ValidationError()
|
|
||||||
|
|
||||||
# If the url contains spaces or does not have any dots
|
# If the url contains spaces or does not have any dots
|
||||||
if field.data.count(" ") > 0 or field.data.count(".") == 0:
|
if field.data.count(" ") > 0 or field.data.count(".") == 0:
|
||||||
@@ -32,7 +31,7 @@ def validate_URL(form, field):
|
|||||||
|
|
||||||
class URLForm(FlaskForm):
|
class URLForm(FlaskForm):
|
||||||
url = StringField(validators=[DataRequired(),
|
url = StringField(validators=[DataRequired(),
|
||||||
Length(min=4, max=2000, message="URL must be between %(min)d and %(max)d characters"),
|
Length(min=4, max=2000, message="Invalid URL Length"),
|
||||||
validate_URL])
|
validate_URL])
|
||||||
|
|
||||||
submit = SubmitField("Shorten")
|
submit = SubmitField("Shorten")
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 3% 0 -2vh 0;
|
margin: 3% 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-container {
|
.page-container {
|
||||||
|
|||||||
Reference in New Issue
Block a user