From 753f1d95913915f62d3f18c1075ff1ff08db20eb Mon Sep 17 00:00:00 2001 From: VG Date: Fri, 28 Nov 2014 00:15:19 +0100 Subject: add hash generation from content, and default page display --- pasteme.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 pasteme.py (limited to 'pasteme.py') diff --git a/pasteme.py b/pasteme.py new file mode 100755 index 0000000..37f4522 --- /dev/null +++ b/pasteme.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 + +import bottle +import identigen + +@bottle.route('/') +def route_root(): + return bottle.template('welcome_page') + +@bottle.route('/', method='POST') +def route_paste_post(): + content = bottle.request.forms.get('content') + return content + ' ' + identigen.generate(content) + +@bottle.route('/') +@bottle.route('//') +def route_paste_get(pid, pformat='colored'): + return 'paste: {}, {}'.format(pid, pformat) + +if __name__ == '__main__': + print('I: Starting application with development server') + bottle.run(host='0.0.0.0', port=8080, debug=True, reloader=True) +else: + print('I: Starting application as a wsgi application') + application = bottle.default_app() # application used for wsgi mode -- cgit v1.2.3