# Path: bamboo/config/routes.py
# def connect_routes(dispatcher):
#     """This function takes the dispatcher and attaches the routes.
# 
#     :param dispatcher: The CherryPy dispatcher.
#     """
#     # controller instances map
#     controllers = {
#         'root': Root(),
#         'calculations': Calculations(),
#         'datasets': Datasets(),
#         'version': Version(),
#     }
# 
#     # map them into args to dispatcher
#     dictify = lambda x: dict(zip(
#         ['name', 'conditions', 'route', 'controller', 'action'], x))
#     route_case = {
#         'conditions': lambda v: dict(method=v),
#         'controller': lambda v: controllers[v],
#     }
#     kwarg_map = lambda d: {
#         k: route_case.get(k, lambda v: v)(v) for k, v in d.iteritems()
#     }
# 
#     routes = [kwarg_map(dictify(route)) for route in ROUTES + options()]
# 
#     # attach them
#     for route in routes:
#         dispatcher.connect(**route)


import os
import sys
import cherrypy
from bamboo.config.routes import connect_routes
#!/usr/bin/env python

sys.path.append(os.getcwd())




# use routes dispatcher
dispatcher = cherrypy.dispatch.RoutesDispatcher()
routes_conf = {'/': {'request.dispatch': dispatcher}}
local_conf = 'bamboo/config/local.conf'

# connect routes

# Path: bamboo/config/routes.py
# def connect_routes(dispatcher):
#     """This function takes the dispatcher and attaches the routes.
# 
#     :param dispatcher: The CherryPy dispatcher.
#     """
#     # controller instances map
#     controllers = {
#         'root': Root(),
#         'calculations': Calculations(),
#         'datasets': Datasets(),
#         'version': Version(),
#     }
# 
#     # map them into args to dispatcher
#     dictify = lambda x: dict(zip(
#         ['name', 'conditions', 'route', 'controller', 'action'], x))
#     route_case = {
#         'conditions': lambda v: dict(method=v),
#         'controller': lambda v: controllers[v],
#     }
#     kwarg_map = lambda d: {
#         k: route_case.get(k, lambda v: v)(v) for k, v in d.iteritems()
#     }
# 
#     routes = [kwarg_map(dictify(route)) for route in ROUTES + options()]
# 
#     # attach them
#     for route in routes:
#         dispatcher.connect(**route)


# Path: scripts/run_server.py
import os
import sys
import cherrypy
from bamboo.config.routes import connect_routes

#!/usr/bin/env python

sys.path.append(os.getcwd())




# use routes dispatcher
dispatcher = cherrypy.dispatch.RoutesDispatcher()
routes_conf = {'/': {'request.dispatch': dispatcher}}
local_conf = 'bamboo/config/local.conf'

# connect routes

connect_routes(dispatcher)