aboutsummaryrefslogtreecommitdiffstats
path: root/pasteme.py
diff options
context:
space:
mode:
authorVG <vg@devys.org>2014-11-28 00:15:19 +0100
committerVG <vg@devys.org>2014-11-28 00:15:19 +0100
commit753f1d95913915f62d3f18c1075ff1ff08db20eb (patch)
tree57bc09d9b1b7461facc5c976f96e703a1011c0a9 /pasteme.py
parent483a357e9547aa233db79855d8aa8aef3b3e60e6 (diff)
downloadpasteme-753f1d95913915f62d3f18c1075ff1ff08db20eb.tar.gz
pasteme-753f1d95913915f62d3f18c1075ff1ff08db20eb.tar.bz2
pasteme-753f1d95913915f62d3f18c1075ff1ff08db20eb.zip
add hash generation from content, and default page display
Diffstat (limited to 'pasteme.py')
-rwxr-xr-xpasteme.py25
1 files changed, 25 insertions, 0 deletions
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('/<pid>')
+@bottle.route('/<pid>/<pformat>')
+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