From fc9f8632da09763b54e25861dc6e1798091d0bba Mon Sep 17 00:00:00 2001
From: Cédric Picard <cedric.picard@efrei.net>
Date: Fri, 28 Nov 2014 20:26:12 +0100
Subject: Changed from internal error to bad request error

---
 pasteme.py               | 10 +++++-----
 views/bad_request.tpl    | 13 +++++++++++++
 views/internal_error.tpl | 13 -------------
 3 files changed, 18 insertions(+), 18 deletions(-)
 create mode 100644 views/bad_request.tpl
 delete mode 100644 views/internal_error.tpl

diff --git a/pasteme.py b/pasteme.py
index f155502..b5cd308 100755
--- a/pasteme.py
+++ b/pasteme.py
@@ -25,10 +25,10 @@ def route_paste_post():
         pid = identigen.generate(content)
     except AttributeError as e:
         print(e)
-        bottle.abort(500)
+        bottle.abort(400)
     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>')
@@ -60,9 +60,9 @@ def route_paste_get(pid, pformat='colored'):
 def error404(error):
     return bottle.template("not_found")
 
-@bottle.error(500)
-def error500(error):
-    return bottle.template("internal_error")
+@bottle.error(400)
+def error400(error):
+    return bottle.template("bad_request")
 
 if __name__ == '__main__':
     print('I: Starting application with development server')
diff --git a/views/bad_request.tpl b/views/bad_request.tpl
new file mode 100644
index 0000000..e21eddc
--- /dev/null
+++ b/views/bad_request.tpl
@@ -0,0 +1,13 @@
+<html>
+<head>
+<title>Bad request (400)</title>
+</head>
+<body>
+<h2>Hello</h2>
+<p>I don't know how to manage your request.</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>
diff --git a/views/internal_error.tpl b/views/internal_error.tpl
deleted file mode 100644
index 804ade3..0000000
--- a/views/internal_error.tpl
+++ /dev/null
@@ -1,13 +0,0 @@
-<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>
-- 
cgit v1.2.3