Permalink
Browse files

Wrote a simple FrontController

  • Loading branch information...
1 parent 50e3a6a commit 0274daa87f1a4e8c0594ccae93188eed05e1230d @ShinNoNoir committed Sep 27, 2011
Showing with 7 additions and 37 deletions.
  1. +2 −0 .gitignore
  2. +5 −1 api.py
  3. +0 −36 wsgi.py
View
@@ -1,3 +1,5 @@
*~
.project
.pydevproject
+*.pyc
+
View
6 api.py
@@ -7,7 +7,11 @@ class Heatmap:
/heatmap?video=<video_id>&[getkey=1|0]
"""
def GET(self, video, getkey=False):
- return '%r %r' % (video, getkey)
+ res = {}
+ res['heatmap'] = []
+ if getkey:
+ res['key'] = None
+ return res
class Echo:
def GET(self, **kwargs):
View
36 wsgi.py
@@ -1,7 +1,6 @@
#!/bin/env python
import web
import json
-from cgi import parse_qs
from api import Heatmap, Echo
@@ -50,38 +49,3 @@ def badrequest(self, message):
else:
web.config.debug = False
application = app.wsgifunc()
-
-
-
-#RESPONSE_JSON = [('Content-type', 'application/json')]
-#RESPONSE_TXT = [('Content-type', 'text/plain')]
-
-
-#def application(environ, start_response):
-# query = parse_qs(environ['QUERY_STRING'])
-# path = parse_qs(environ['PATH_INFO'])
-#
-# response_headers = RESPONSE_TXT
-# response_body = ''
-#
-# if path in routes:
-# try:
-# response_status = '200 OK'
-# response_body = routes[path](environ)
-# response_headers = RESPONSE_JSON
-# except Exception as e:
-# response_status = '500'
-# response_body = repr(e)
-# else:
-# response_status = '404 NotFound'
-# response_body = 'boo'
-
-#
-#
-# response_headers = [('Content-type', 'text/plain')]
-# start_response(response_status, response_headers)
-# return [response_body]
-
- #return ['Hello world!\n'] + ['{0}={1}\n'.format(k,environ[k])
- # for k in sorted(environ)] + [repr(query)]
-

0 comments on commit 0274daa

Please sign in to comment.