From d15f631d1c3440bf2c059bf37d8c914ddb9eb30e Mon Sep 17 00:00:00 2001 From: Hamid Askerov Date: Sat, 22 Jun 2019 19:50:34 +0400 Subject: [PATCH] Already shortened url error message fixed (#38) * Already shortened url message fixed * Error message rendering changed --- pygmyui/restclient/error_msg.py | 6 +++--- pygmyui/templates/400.html | 4 +++- pygmyui/templates/404.html | 4 +++- pygmyui/templates/500.html | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pygmyui/restclient/error_msg.py b/pygmyui/restclient/error_msg.py index ecae0d1..795c2c3 100644 --- a/pygmyui/restclient/error_msg.py +++ b/pygmyui/restclient/error_msg.py @@ -1,8 +1,8 @@ import json -INVALID_TOKEN = dict(error="Please log in again to continue.") -INTERNAL_SERVER_ERROR_API = "Something went wrong." +INVALID_TOKEN = dict(error=["Please log in again to continue."]) +INTERNAL_SERVER_ERROR_API = ["Something went wrong."] def API_ERROR(error_message): @@ -19,4 +19,4 @@ def API_ERROR(error_message): import traceback traceback.print_exc() error_message = INTERNAL_SERVER_ERROR_API - return dict(error=error_message) + return dict(error=error_message if isinstance(error_message,list) else [error_message]) diff --git a/pygmyui/templates/400.html b/pygmyui/templates/400.html index 8785517..07c8d94 100644 --- a/pygmyui/templates/400.html +++ b/pygmyui/templates/400.html @@ -3,7 +3,9 @@ {% block content %}

400


{% if error %} -

{{error}}

+ {%for err in error%} +

{{err}}

+ {%endfor%} {% else %}

Bad Request

{% endif %} diff --git a/pygmyui/templates/404.html b/pygmyui/templates/404.html index 3d39371..3e7aae7 100644 --- a/pygmyui/templates/404.html +++ b/pygmyui/templates/404.html @@ -3,7 +3,9 @@ {% block content %}

404


{% if error %} -

{{error}}

+ {%for err in error%} +

{{err}}

+ {%endfor%} {% else %}

Page Not Found

{% endif %} diff --git a/pygmyui/templates/500.html b/pygmyui/templates/500.html index 12291e3..65a48aa 100644 --- a/pygmyui/templates/500.html +++ b/pygmyui/templates/500.html @@ -3,8 +3,10 @@ {% block content %}

500


{% if error %} -

{{error}}

-{% else %} + {%for err in error%} +

{{err}}

+ {%endfor%} +{% else %}

Something Went Wrong

{% endif %} {% endblock content %}