From 4b1697e794c0df2d5ed92a7c09c824fcd0e6c950 Mon Sep 17 00:00:00 2001 From: max Date: Wed, 2 May 2012 16:23:26 +0700 Subject: [PATCH] Added error404 --- start.py | 8 +++++--- views/404.tpl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/start.py b/start.py index 612577c..0d4bedd 100755 --- a/start.py +++ b/start.py @@ -27,7 +27,7 @@ from src import settings, Paste, drop_privileges app = Bottle() - + @app.route('/') @view('home') @@ -91,15 +91,17 @@ def display_paste(paste_id): except (TypeError, ValueError): #abort(404, u"This paste doesn't exist or has expired") - return error404() + return error404(ValueError) return {'paste': paste, 'keep_alive': keep_alive, 'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB} +@app.error(404) @view('404') -def error404(): +def error404(code): 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 index 7fb3aa8..2a1b4f8 100644 --- a/views/404.tpl +++ b/views/404.tpl @@ -2,7 +2,7 @@ × Error! - This paste no longer exist. + This paste has expired or wrong url, please check again.