diff options
author | Cédric Picard <cedric.picard@efrei.net> | 2014-11-28 18:45:41 +0100 |
---|---|---|
committer | Cédric Picard <cedric.picard@efrei.net> | 2014-11-28 18:45:41 +0100 |
commit | 5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1 (patch) | |
tree | 3196dde4c13489cfe10448a1b793a835ab281797 | |
parent | cad0e50f61e1e361dcc0e0625d4f19267cd4c7c1 (diff) | |
download | pasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.tar.gz pasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.tar.bz2 pasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.zip |
Fixed void content error
-rwxr-xr-x | pasteme.py | 8 | ||||
-rw-r--r-- | views/internal_error.tpl | 13 |
2 files changed, 19 insertions, 2 deletions
@@ -21,10 +21,14 @@ def route_root(): @bottle.route('/', method='POST') def route_paste_post(): content = bottle.request.forms.get('content') - pid = identigen.generate(content) + try: + pid = identigen.generate(content) + except AttributeError as e: + print(e) + return bottle.template('internal_error') path = pathbase / pid with path.open(mode='wb') as fd: - fd.write(content.encode('utf8')) + fd.write(content.encode('utf8')) bottle.redirect('/' + pid) @bottle.route('/static/<path:path>') diff --git a/views/internal_error.tpl b/views/internal_error.tpl new file mode 100644 index 0000000..804ade3 --- /dev/null +++ b/views/internal_error.tpl @@ -0,0 +1,13 @@ +<html> +<head> +<title>Internal Server Error (500)</title> +</head> +<body> +<h2>Hello</h2> +<p>Your request generated a server error.</p> + +<p>If you think that your request was valid, please report this issue</p> + +<p>I'm sorry for you, but <i>nonetheless</i> I whish you a very good day.</p> +</body> +</html> |