Beispiel #1
0
    def init_routes(self):
        import pkgutil,sys,inspect
        import application.controllers
        from whirlwind.view.decorators import route
        from config.routes import route_list
        
        #import all the controllers so the route decorators will run
        package = application.controllers
        prefix = package.__name__ + "."
        
        for importer, modname, ispkg in pkgutil.iter_modules(package.__path__, prefix):
            module = __import__(modname)
        
        #grab the routes defined via the route decorator
        url_routes = route.get_routes()
        
        #add the routes from our route file
        url_routes.extend(route_list)

        return url_routes
Beispiel #2
0
    def init_routes(self):
        import pkgutil, sys, inspect
        import application.controllers
        from whirlwind.view.decorators import route
        from config.routes import route_list

        #import all the controllers so the route decorators will run
        package = application.controllers
        prefix = package.__name__ + "."

        for importer, modname, ispkg in pkgutil.iter_modules(
                package.__path__, prefix):
            module = __import__(modname)

        #grab the routes defined via the route decorator
        url_routes = route.get_routes()

        #add the routes from our route file
        url_routes.extend(route_list)

        return url_routes
Beispiel #3
0
    def init_routes(self,package_name,include_routes_file=True):
        import pkgutil,sys,inspect
        from whirlwind.view.decorators import route
        
        package = __import__(package_name)
        controllers_module = sys.modules[package_name]
        
        prefix = controllers_module.__name__ + "."
        
        for importer, modname, ispkg in pkgutil.iter_modules(controllers_module.__path__, prefix):
            module = __import__(modname)
        
        #grab the routes defined via the route decorator
        url_routes = route.get_routes()
        
        #add the routes from our route file
        if include_routes_file:
            from config.routes import route_list
            url_routes.extend(route_list)


        return url_routes