diff options
author | Leif Johansson <leifj@sunet.se> | 2012-10-09 08:42:27 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-10-09 08:42:27 +0200 |
commit | 2051a9fd3d4b3871aa8ff503d208e7f3e938f920 (patch) | |
tree | 73ef5395f2a401830ee7a87447dc553f25dd5f04 | |
parent | f3b0dbaa669159ec880848f7b70220791a1427fa (diff) |
404 and 500 handlers
-rw-r--r-- | meetingtools/context_processors.py | 3 | ||||
-rw-r--r-- | meetingtools/multiresponse.py | 3 | ||||
-rw-r--r-- | meetingtools/settings.py | 2 | ||||
-rw-r--r-- | meetingtools/urls.py | 7 | ||||
-rw-r--r-- | static/css/style.css | 12 | ||||
-rw-r--r-- | templates/404.html | 56 | ||||
-rw-r--r-- | templates/500.html | 25 |
7 files changed, 105 insertions, 3 deletions
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 %} +<link href='http://fonts.googleapis.com/css?family=Mrs+Saint+Delafield' rel='stylesheet' type='text/css'> +<style type="text/css"> +.magritte { + font-family: 'Mrs Saint Delafield', cursive; + font-size: 30px; + padding-top: 20px; +} +.magritte-outer { + font-size: 48px; + text-align: center; + width: 50%; +} +.url { + font-family: Courier, monospace; + margin-top: 20px; + margin-bottom: 20px; + font-weight: bold; + padding: 20px; + border-bottom: 1px solid #dddddd; +} +.explain { + margin-top: 50px; + text-align: center; + font-size: larger; +} +</style> +{% endblock %} +{% block content %} +<div> + <div class="page-header"> + <h1>404 - Page Not Found</h1> + </div> + <div class="row"> + <div class="span3"> + + </div> + <div class="magritte-outer span4 well"> + <div class="url">{{request_path}}</div> + + <div class="magritte">Ceci n'est pas une url</div> + </div> + <div class="span2"> + + </div> + </div> + + <div class="explain row"> + <p> + The page you are looking for does not seem to be here. Please <a href="/">go back and try again</a> or + <a class="btn btn-small btn-success" href="/myroom">Click Here To Start an Online Meeting Now</a> + </p> + </div> +</div> +{% 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 @@ +<!DOCTYPE html> +<html> +<head> + <title>Meeting Tools</title> + <meta http-equiv="content-type" content="text/html;charset=utf-8" /> + <meta http-equiv="Content-Style-Type" content="text/css" /> + <link type="text/css" href="{{STATIC_URL}}/bootstrap/css/bootstrap.min.css" rel="stylesheet"/> + <link href="{{theme.base}}/lavish.less" rel="stylesheet/less" type="text/css" /> + <link href="{{STATIC_URL}}/css/style.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div class="container"> + <div class="error-page alert"> + <div class="page-header"><h1>Oh Crap!</h1></div> + <p> + Something just went badly wrong with meetingtools... But don't worry, we're on it! + </p> + </div> + <div class="pull-right error-retry"> + <p>In the meantime you could try to <a href="/">go back and try again...</a></p> + </div> + <div class="clearfix"></div> + <hr/> +</div> +</body>
\ No newline at end of file |