Source

pyrest / pyrest / integration / cherry.py

Diff from to

File pyrest/integration/cherry.py

 import cherrypy
 from pyrest.pyrest import get_handlers, requesthandler
-from pyrest.examples import hg
+
+API = None #This should be set to a PyRest backend API if used as WSGI application
 
 class PyRest(object):
-    def __init__(self):
-        self._handlers = get_handlers(hg)
+    def __init__(self, api):
+        self._handlers = get_handlers(api)
         
     def index(self):
         return "Awesome API..."
     index.exposed = True
     api.exposed = True
 
-CONF = {
+
+
+if __name__ == '__main__':
+    from pyrest.examples import hg
+    CONF = {
     'global': {
         'server.socket_host': '0.0.0.0',
         'server.socket_port': 8888,
-    }
-}
+    }}
 
+    ROOT = PyRest(hg)
 
-if __name__ == '__main__':
-    ROOT = PyRest()
     cherrypy.quickstart(ROOT, '/', CONF)
     
+#Not actually working right now
 def application(environ, start_response):
   cherrypy.tree.mount(PyRest(), '/', None)
   return cherrypy.tree(environ, start_response)