Mercurial > bzezpatch
changeset 3:026d83327522
app should work when mounted anywhere now.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Wed, 02 Jun 2010 21:34:40 -0700 |
parents | 9f612c24ac23 |
children | 4b66cf5f42bf |
files | bzezpatch/app.py static-files/app.js |
diffstat | 2 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/bzezpatch/app.py Wed Jun 02 19:36:52 2010 -0700 +++ b/bzezpatch/app.py Wed Jun 02 21:34:40 2010 -0700 @@ -38,15 +38,10 @@ [('Content-Type', mimetype)]) return [content] - if path.startswith('/static-files/') and method == 'GET': - filename = path.split('/')[2] - if filename in os.listdir(self.static_files_dir): - mimetype, enc = mimetypes.guess_type(filename) - f = open(os.path.join(self.static_files_dir, filename)) - return ok_response(f.read(), mimetype=mimetype) - else: - return error_404() - elif path == '/try' and method == 'POST': + if path == '/': + path = '/index.html' + + if path == '/try' and method == 'POST': try: info = json.loads(input) url = info['url'] @@ -65,5 +60,13 @@ info = {'success': False, 'log': tmplog.read()} return ok_response(json.dumps(info), mimetype=self.JSON_TYPE) + elif path.startswith('/') and method == 'GET': + filename = path.split('/')[1] + if filename in os.listdir(self.static_files_dir): + mimetype, enc = mimetypes.guess_type(filename) + f = open(os.path.join(self.static_files_dir, filename)) + return ok_response(f.read(), mimetype=mimetype) + else: + return error_404() return error_404()