fix without logo

This commit is contained in:
Cayo Puigdefabregas 2023-03-13 17:04:57 +01:00
parent d97eb08cce
commit b140dc5f89
3 changed files with 8 additions and 1 deletions

View file

@ -141,6 +141,9 @@ class SanitizationEntityForm(FlaskForm):
if not is_valid:
return False
if not self.logo.data:
return True
extensions = ["jpg", "jpeg", "png", "gif", "svg"]
if self.logo.data.lower().split(".")[-1] not in extensions:
txt = "Error in Url field - accepted only .PNG, .JPG and .GIF. extensions"

View file

@ -1565,6 +1565,9 @@ class CustomerDetailsForm(FlaskForm):
if not is_valid:
return is_valid
if not self.logo.data:
return True
extensions = ["jpg", "jpeg", "png", "gif", "svg"]
if self.logo.data.lower().split(".")[-1] not in extensions:
txt = "Error in Url field - accepted only .PNG, .JPG and .GIF. extensions"

View file

@ -145,7 +145,8 @@ class SanitizationEntityView(View):
messages.error('Error modifying Sanitization data!')
if form.errors:
for k in form.errors.keys():
txt = "{}: {}".format(k, form.errors[k])
errors = ", ".join(form.errors[k])
txt = "{}: {}".format(k, errors)
messages.error(txt)
return flask.redirect(flask.url_for('core.user-profile'))