diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-03-14 00:34:37 -0700 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-03-14 00:34:37 -0700 |
| commit | 365afbe3791c849f957c2b6b4f5433b4229a5598 (patch) | |
| tree | d31f0510debbc1d25eab74d8658817b1886b019a | |
| parent | b1e8a0671205c36fa3561228555fe3c74de03fc4 (diff) | |
template works, still need to escape
| -rw-r--r-- | app.py | 7 | ||||
| -rwxr-xr-x | index.html | 4 |
2 files changed, 7 insertions, 4 deletions
@@ -4,17 +4,18 @@ import random import requests import string -from bottle import post, route, request, run, static_file +from bottle import post, route, request, run, static_file, template @route('/') def index(name='home'): - return static_file('index.html', root=os.path.dirname(__file__), mimetype='text/html') + return template('index.html', sig=None) @route('/s/:id') def sig(id='home'): url = 'https://pinkyswear.cloudant.com/pinkyswear/%s' % id r = requests.get(url, auth=('pinkyswear', 'abc123')) - return json.loads(r.content)['s'] + sig = json.loads(r.content)['s'] + return template('index.html', sig=sig) @post('/s') def sig(id='home'): @@ -29,7 +29,9 @@ <script> $(document).ready(function() { var sig = $('.sigPad').signaturePad({drawOnly:true,errorMessage:"Write the swear",errorMessageDraw:"sign the swear bro"}); - //sig.regenerate(sig); + %if sig: + sig.regenerate({{ sig }}); + %end }); </script> <script src="https://raw.github.com/yuvadm/pinkyswear/master/js/json2.min.js"></script> |
