From 0db137daf52bdce027fabe9be35b9ccc016645b9 Mon Sep 17 00:00:00 2001 From: xemeds Date: Sun, 19 Jul 2020 22:14:49 +0000 Subject: [PATCH] Fixed a double error bug --- tiny0/forms.py | 5 ++--- tiny0/static/style.css | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tiny0/forms.py b/tiny0/forms.py index f2277b6..60ce28f 100644 --- a/tiny0/forms.py +++ b/tiny0/forms.py @@ -6,8 +6,7 @@ from wtforms.validators import DataRequired, Length def validate_URL(form, field): # Make sure the url is not too short or long if len(field.data) < 4 or len(field.data) > 2000: - # Raise a ValidationError - raise ValidationError() + return # If the url contains spaces or does not have any dots if field.data.count(" ") > 0 or field.data.count(".") == 0: @@ -32,7 +31,7 @@ def validate_URL(form, field): class URLForm(FlaskForm): 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]) submit = SubmitField("Shorten") diff --git a/tiny0/static/style.css b/tiny0/static/style.css index 038027b..ecc85ea 100644 --- a/tiny0/static/style.css +++ b/tiny0/static/style.css @@ -81,7 +81,7 @@ body { text-align: center; font-size: 100%; padding: 0; - margin: 3% 0 -2vh 0; + margin: 3% 0 0 0; } .page-container {