From 2051a9fd3d4b3871aa8ff503d208e7f3e938f920 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 9 Oct 2012 08:42:27 +0200 Subject: 404 and 500 handlers --- meetingtools/context_processors.py | 3 +- meetingtools/multiresponse.py | 3 ++ meetingtools/settings.py | 2 +- meetingtools/urls.py | 7 +++++ static/css/style.css | 12 +++++++- templates/404.html | 56 ++++++++++++++++++++++++++++++++++++++ templates/500.html | 25 +++++++++++++++++ 7 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 templates/404.html create mode 100644 templates/500.html diff --git a/meetingtools/context_processors.py b/meetingtools/context_processors.py index 491e785..af83fbe 100644 --- a/meetingtools/context_processors.py +++ b/meetingtools/context_processors.py @@ -1,4 +1,5 @@ from django.core.exceptions import ImproperlyConfigured +from utils import base_url __author__ = 'leifj' @@ -23,4 +24,4 @@ def theme(request): return _w(ctx) def misc_urls(request): - return {'LOGIN_URL': settings.LOGIN_URL} \ No newline at end of file + return {'LOGIN_URL': settings.LOGIN_URL,'BASE_URL':base_url(request)} \ No newline at end of file diff --git a/meetingtools/multiresponse.py b/meetingtools/multiresponse.py index fa46cc4..6d62fe0 100644 --- a/meetingtools/multiresponse.py +++ b/meetingtools/multiresponse.py @@ -49,6 +49,9 @@ def json_response(data,request=None): return r +def render500(request): + return render_to_response("500.html",RequestContext(request,{},[context_processors.misc_urls])) + def render403(message="You don't seem to have enough rights for what you are trying to do....",dict={}): dict['message'] = message return HttpResponseForbidden(loader.render_to_string("403.html",dict)) diff --git a/meetingtools/settings.py b/meetingtools/settings.py index 8e72dca..873a74d 100644 --- a/meetingtools/settings.py +++ b/meetingtools/settings.py @@ -4,7 +4,7 @@ from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS import meetingtools.site_logging import os -DEBUG = True +DEBUG = False TEMPLATE_DEBUG = DEBUG ADMINS = ( diff --git a/meetingtools/urls.py b/meetingtools/urls.py index 1aa688f..30f8efd 100644 --- a/meetingtools/urls.py +++ b/meetingtools/urls.py @@ -11,6 +11,11 @@ admin.autodiscover() def welcome(request): return redirect_to('/rooms') +def crap(request): + raise ValueError("Bad crab!") + +handler500 = "meetingtools.multiresponse.render500" + urlpatterns = patterns('', (r'^$',welcome), (r'^saml2/sp/',include('djangosaml2.urls')), @@ -21,6 +26,8 @@ urlpatterns = patterns('', (r'^accounts/login-federated$','meetingtools.apps.auth.views.accounts_login_federated'), (r'^accounts/logout$','meetingtools.apps.auth.views.logout'), (r'^user/?(.*)$','meetingtools.apps.room.views.list_rooms'), + (r'^crab/',crap), + ('^myroom/?','meetingtools.apps.room.views.myroom'), (r'^(?:room|rooms)$','meetingtools.apps.room.views.list_rooms'), (r'^go/(\d+)$','meetingtools.apps.room.views.go_by_id'), (r'^go/(.+)$','meetingtools.apps.room.views.go_by_path'), diff --git a/static/css/style.css b/static/css/style.css index 9430b36..28e745e 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1 +1,11 @@ -.spinner { vertical-align: botton; margin-left: 8px; } +.spinner { vertical-align: bottom; margin-left: 8px; } +.error-page { + margin-top:50px; + height: 480px; + background-repeat:no-repeat; + background-image: url('http://openclipart.org/people/hatso1/cartoon_crab.svg'); + background-position: right bottom; +} +.error-page h1 { font-size: 70px; } +.error-page p { font-size: large; font-weight: bold;} +.error-retry p { font-size: large; font-weight: bold;} \ No newline at end of file diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..ffcc4c6 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,56 @@ +{% extends "base.html" %} +{% block meta %} + + +{% endblock %} +{% block content %} +
+ +
+
+ +
+
+
{{request_path}}
+ +
Ceci n'est pas une url
+
+
+ +
+
+ +
+

+ The page you are looking for does not seem to be here. Please go back and try again or + Click Here To Start an Online Meeting Now +

+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000..2792a4c --- /dev/null +++ b/templates/500.html @@ -0,0 +1,25 @@ + + + + Meeting Tools + + + + + + + +
+
+ +

+ Something just went badly wrong with meetingtools... But don't worry, we're on it! +

+
+
+

In the meantime you could try to go back and try again...

+
+
+
+
+ \ No newline at end of file -- cgit v1.1