From 2e537cd22b6928155d449cbce21566ecd983147c Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 2 May 2012 16:36:57 +0700 Subject: [PATCH] 404 error are now in red with a more explicit message. Local settings support have been added, and debug default value set to false --- .gitignore | 1 + settings.py | 10 +++++++++- start.py | 6 ++++-- views/404.tpl | 6 +++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 8d79397..0c86496 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ dist content *.sublime-project *.sublime-workspace +settings_local.py diff --git a/settings.py b/settings.py index 9da618f..b70461c 100644 --- a/settings.py +++ b/settings.py @@ -11,7 +11,7 @@ STATIC_FILES_ROOT = os.path.join(ROOT_DIR, 'static') # debug will get you error message and auto reload # don't set this to True in production -DEBUG = True +DEBUG = False # absolute path where the paste files should be store # default in projectdirectory/static/content/ @@ -31,3 +31,11 @@ GROUP = None # browser MAX_SIZE = 1024 * 500 MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0)) + +# this import a file named settings_local.py if it exists +# you may want to create such a file to have different settings +# on each machine +try: + from settings_local import * +except ImportError: + pass \ No newline at end of file diff --git a/start.py b/start.py index 0d4bedd..1c74c1d 100755 --- a/start.py +++ b/start.py @@ -27,7 +27,7 @@ from src import settings, Paste, drop_privileges app = Bottle() - + @app.route('/') @view('home') @@ -93,7 +93,9 @@ def display_paste(paste_id): #abort(404, u"This paste doesn't exist or has expired") return error404(ValueError) - return {'paste': paste, 'keep_alive': keep_alive, 'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB} + return {'paste': paste, 'keep_alive': keep_alive, + 'max_size': settings.MAX_SIZE, + 'max_size_kb': settings.MAX_SIZE_KB} @app.error(404) diff --git a/views/404.tpl b/views/404.tpl index 2a1b4f8..c3d5418 100644 --- a/views/404.tpl +++ b/views/404.tpl @@ -1,8 +1,8 @@ -

+

× - Error! + 404 Error! - This paste has expired or wrong url, please check again. + Either this paste has expired or this page never existed.