Beispiel #1
0
    def __init__(self, default_host="", transforms=None, **settings):
        logger = logging.getLogger(__name__)
        logger.debug("Wiring application located at %s." % firenado.conf.APP_ROOT_PATH)
        self.components = {}
        handlers = []
        static_handlers = []
        data.configure_data_sources(firenado.conf.app["data"]["sources"], self)
        settings["static_path"] = os.path.join(os.path.dirname(__file__), "static")
        self.__load_components()
        for key, component in iteritems(self.components):
            component_handlers = component.get_handlers()
            for i in range(0, len(component_handlers)):
                from firenado.core.websocket import TornadoWebSocketHandler

                if issubclass(component_handlers[i][1], TornadoHandler) or issubclass(
                    component_handlers[i][1], TornadoWebSocketHandler
                ):
                    if len(component_handlers[i]) < 3:
                        component_handlers[i] = (
                            component_handlers[i][0],
                            component_handlers[i][1],
                            {"component": component},
                        )
                    else:
                        component_handlers[i][1].component = component
            handlers = handlers + component_handlers
        if firenado.conf.app["component"]:
            settings["static_path"] = os.path.join(
                self.components[firenado.conf.app["component"]].get_component_path(), "static"
            )
        else:
            settings["static_path"] = os.path.join(os.path.dirname(__file__), "static")
        tornado.web.Application.__init__(
            self, handlers=handlers, default_host=default_host, transforms=transforms, **settings
        )
Beispiel #2
0
 def __init__(self, default_host="", transforms=None, **settings):
     self.components = {}
     handlers = []
     static_handlers = []
     data.configure_data_sources(firenado.conf.app['data']['sources'], self)
     settings['static_path'] = os.path.join(
         os.path.dirname(__file__), "static")
     self.__load_components()
     for key, component in self.components.iteritems():
         component_handlers = component.get_handlers()
         for i in range(0, len(component_handlers)):
             from firenado.core.websocket import TornadoWebSocketHandler
             if issubclass(
                 component_handlers[i][1], TornadoHandler
             ) or issubclass(
                 component_handlers[i][1], TornadoWebSocketHandler
             ):
                 if len(component_handlers[i]) < 3:
                     component_handlers[i] = (
                         component_handlers[i][0],
                         component_handlers[i][1],
                         {'component': component}
                     )
                 else:
                     component_handlers[i][1].component = component
         handlers = handlers + component_handlers
     if firenado.conf.app['component']:
         settings['static_path'] = os.path.join(self.components[
             firenado.conf.app['component']].get_component_path(), 'static')
     else:
         settings['static_path'] = os.path.join(
             os.path.dirname(__file__), "static")
     tornado.web.Application.__init__(self, handlers=handlers,
                                      default_host=default_host,
                                      transforms=transforms, **settings)
Beispiel #3
0
    def __init__(self, default_host="", transforms=None, **settings):
        self.components = {}
        handlers = []
        static_handlers = []
        data.configure_data_sources(firenado.conf.app['data']['sources'], self)

        self.__load_components()
        for key, component in self.components.iteritems():
            component_handlers = component.get_handlers()
            for i in range(0, len(component_handlers)):
                if issubclass(component_handlers[i][1], TornadoHandler):
                    if len(component_handlers[i]) < 3:
                        component_handlers[i] = (
                            component_handlers[i][0],
                            component_handlers[i][1],
                            {'component': component}
                        )
                    else:
                        component_handlers[i][1].component = component
            handlers = handlers + component_handlers

        tornado.web.Application.__init__(self, handlers=handlers,
                                         default_host=default_host,
                                         transforms=transforms, **settings)