Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Already shortened url message fixed #38

Merged
merged 4 commits into from
Jun 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygmy/rest/shorturl.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def post(self):
if errors:
log.error('Error in the request payload %s', errors)
if errors.get('long_url'):
errors.update({'error': errors.get('long_url')})
errors.update({'error': " ".join(errors.get('long_url'))})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this. This is not required anymore after changes to the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Sorry, i forgot to remove join.

return jsonify(errors), 400

long_url = data.pop('long_url')
Expand Down
6 changes: 3 additions & 3 deletions pygmyui/restclient/error_msg.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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])
4 changes: 3 additions & 1 deletion pygmyui/templates/400.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{% block content %}
<h1 class="vcenter">400</h1><br>
{% if error %}
<h3 class="vcenter">{{error}}</h3>
{%for err in error%}
<h3 class="vcenter">{{err}}</h3>
{%endfor%}
{% else %}
<h3 class="vcenter">Bad Request</h3>
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion pygmyui/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{% block content %}
<h1 class="vcenter">404</h1><br>
{% if error %}
<h3 class="vcenter">{{error}}</h3>
{%for err in error%}
<h3 class="vcenter">{{err}}</h3>
{%endfor%}
{% else %}
<h3 class="vcenter">Page Not Found</h3>
{% endif %}
Expand Down
6 changes: 4 additions & 2 deletions pygmyui/templates/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
{% block content %}
<h1 class="vcenter">500</h1><br>
{% if error %}
<h3 class="vcenter">{{error}}</h3>
{% else %}
{%for err in error%}
<h3 class="vcenter">{{err}}</h3>
{%endfor%}
{% else %}
<h3 class="vcenter">Something Went Wrong</h3>
{% endif %}
{% endblock content %}