404 error are now in red with a more explicit message. Local settings support have been added, and debug default value set to false

This commit is contained in:
sam 2012-05-02 16:36:57 +07:00
parent 4b1697e794
commit 2e537cd22b
4 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ dist
content
*.sublime-project
*.sublime-workspace
settings_local.py

View File

@ -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

View File

@ -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)

View File

@ -1,8 +1,8 @@
<p class="alert">
<p class="alert alert-error">
<a class="close" data-dismiss="alert" href="#">×</a>
<strong class="title">Error!</strong>
<strong class="title">404 Error!</strong>
<span class="message">
This paste has expired or wrong url, please check again.
Either this paste has expired or this page never existed.
</span>
</p>