[extensions-web] upload: Add a specialized error message for a common error
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] upload: Add a specialized error message for a common error
- Date: Mon, 12 Dec 2011 17:01:42 +0000 (UTC)
commit 777fef0d022aee6627aa5139e15d9e5ec506e4a5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Dec 12 12:01:32 2011 -0500
upload: Add a specialized error message for a common error
sweettooth/extensions/views.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 6a45aa5..797944c 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -7,6 +7,7 @@ from django.contrib import messages
from django.http import HttpResponseForbidden, Http404
from django.shortcuts import get_object_or_404, redirect
from django.template.loader import render_to_string
+from django.utils.safestring import mark_safe
from django.utils import simplejson as json
from sorl.thumbnail.shortcuts import get_thumbnail
@@ -351,6 +352,12 @@ def upload_file(request, pk):
extension.full_clean()
except ValidationError, e:
is_valid = False
+
+ # Output a specialized error message for a common mistake:
+ if getattr(e, 'message_dict', None) and 'url' in e.message_dict:
+ errors = [mark_safe("You have an invalid URL. Make sure your URL "
+ "starts with <pre>http://</pre>")]
+
errors = e.messages
extra_debug = repr(e)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]