aboutsummaryrefslogtreecommitdiffstats
path: root/pasteme.py
diff options
context:
space:
mode:
authorCédric Picard <cedric.picard@efrei.net>2014-11-28 18:45:41 +0100
committerCédric Picard <cedric.picard@efrei.net>2014-11-28 18:45:41 +0100
commit5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1 (patch)
tree3196dde4c13489cfe10448a1b793a835ab281797 /pasteme.py
parentcad0e50f61e1e361dcc0e0625d4f19267cd4c7c1 (diff)
downloadpasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.tar.gz
pasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.tar.bz2
pasteme-5f0f749c7e1962b4a2f67ad1ff0342b5b49140d1.zip
Fixed void content error
Diffstat (limited to 'pasteme.py')
-rwxr-xr-xpasteme.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pasteme.py b/pasteme.py
index b76a685..744b07c 100755
--- a/pasteme.py
+++ b/pasteme.py
@@ -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>')