mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
added 404 template
This commit is contained in:
parent
444c1b6b0b
commit
2a36c3d0be
9
start.py
9
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'))
|
sys.path.append(os.path.join(settings.ROOT_DIR, 'libs'))
|
||||||
|
|
||||||
import bottle
|
import bottle
|
||||||
from bottle import (Bottle, route, run, abort,
|
from bottle import (Bottle, route, run, abort, error,
|
||||||
static_file, debug, view, request)
|
static_file, debug, view, request)
|
||||||
|
|
||||||
import clize
|
import clize
|
||||||
@ -90,11 +90,16 @@ def display_paste(paste_id):
|
|||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
||||||
except (TypeError, 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}
|
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
|
@clize.clize
|
||||||
def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
|
def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
|
||||||
serve_static=settings.DEBUG):
|
serve_static=settings.DEBUG):
|
||||||
|
36
views/404.tpl
Normal file
36
views/404.tpl
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<p class="alert">
|
||||||
|
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||||
|
<strong class="title">Error!</strong>
|
||||||
|
<span class="message">
|
||||||
|
This paste no longer exist.
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="file-upload">
|
||||||
|
<input type="button" class="btn btn-upload" value="Upload File">
|
||||||
|
<input type="file" class="hide-upload" id="file-upload" >
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form class="well" method="post" action="/paste/create">
|
||||||
|
<p class="paste-option">
|
||||||
|
<label for="expiration" >Expiration:</label>
|
||||||
|
<select id="expiration" name="expiration">
|
||||||
|
<option value="burn_after_reading">Burn after reading</option>
|
||||||
|
<option selected value="1_day">1 day</option>
|
||||||
|
<option value="1_month">1 month</option>
|
||||||
|
<option value="never">Never</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<div class="progress progress-striped active">
|
||||||
|
<div class="bar"></div>
|
||||||
|
</div>
|
||||||
|
<textarea rows="10" style="width:100%;"
|
||||||
|
class="input-xlarge"
|
||||||
|
id="content" name="content"></textarea>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
%rebase base max_size=max_size
|
@ -9,7 +9,7 @@
|
|||||||
pastebin featuring burn after reading, an history and
|
pastebin featuring burn after reading, an history and
|
||||||
a clipboard">
|
a clipboard">
|
||||||
|
|
||||||
<link rel="shortcut icon" href="/static/ico/favicon.ico">
|
<link rel="shortcut icon" href="/favicon.ico">
|
||||||
<link href="/static/css/prettify.css" rel="stylesheet" />
|
<link href="/static/css/prettify.css" rel="stylesheet" />
|
||||||
<link href="/static/css/bootstrap.css" rel="stylesheet">
|
<link href="/static/css/bootstrap.css" rel="stylesheet">
|
||||||
<link href="/static/css/style.css" rel="stylesheet">
|
<link href="/static/css/style.css" rel="stylesheet">
|
||||||
|
Loading…
Reference in New Issue
Block a user