From 2a36c3d0be307fa30dcf807c2f248177c6cd1290 Mon Sep 17 00:00:00 2001
From: max
Date: Wed, 2 May 2012 15:46:51 +0700
Subject: [PATCH] added 404 template
---
start.py | 9 +++++++--
views/404.tpl | 36 ++++++++++++++++++++++++++++++++++++
views/base.tpl | 2 +-
3 files changed, 44 insertions(+), 3 deletions(-)
create mode 100644 views/404.tpl
diff --git a/start.py b/start.py
index 536cbb8..612577c 100755
--- a/start.py
+++ b/start.py
@@ -18,7 +18,7 @@ sys.path.insert(0, os.path.dirname(settings.ROOT_DIR))
sys.path.append(os.path.join(settings.ROOT_DIR, 'libs'))
import bottle
-from bottle import (Bottle, route, run, abort,
+from bottle import (Bottle, route, run, abort, error,
static_file, debug, view, request)
import clize
@@ -90,11 +90,16 @@ def display_paste(paste_id):
raise ValueError()
except (TypeError, ValueError):
- abort(404, u"This paste doesn't exist or has expired")
+ #abort(404, u"This paste doesn't exist or has expired")
+ return error404()
return {'paste': paste, 'keep_alive': keep_alive, 'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
+@view('404')
+def error404():
+ return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
+
@clize.clize
def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
serve_static=settings.DEBUG):
diff --git a/views/404.tpl b/views/404.tpl
new file mode 100644
index 0000000..7fb3aa8
--- /dev/null
+++ b/views/404.tpl
@@ -0,0 +1,36 @@
+
+ ×
+ Error!
+
+ This paste no longer exist.
+
+
+
+
+
+
+
+
+
+
+
+
+%rebase base max_size=max_size
diff --git a/views/base.tpl b/views/base.tpl
index 942994f..3274795 100644
--- a/views/base.tpl
+++ b/views/base.tpl
@@ -9,7 +9,7 @@
pastebin featuring burn after reading, an history and
a clipboard">
-
+