(self, controller)
return mycontroller
Locates a controller by attempting to import it then grab
        the SomeController instance from the imported module.

        Controller name is assumed to be a module in the controllers
        directory unless it contains a '.' or ':' which is then assumed
        to be a dotted path to the module and name of the controller
        object.

        Override this to change how the controller object is found once
        the URL has been resolved.
Locates a controller by attempting to import it then grab
        the SomeController instance from the imported module.
Locates a controller by attempting to import it then grab the SomeController instance from the imported module .
def find_controller(self, controller):
        """Locates a controller by attempting to import it then grab
        the SomeController instance from the imported module.

        Controller name is assumed to be a module in the controllers
        directory unless it contains a '.' or ':' which is then assumed
        to be a dotted path to the module and name of the controller
        object.

        Override this to change how the controller object is found once
        the URL has been resolved.

        """
        # If this isn't a basestring, its an object, assume that its the
        # proper instance to begin with
        if not isinstance(controller, basestring):
            return controller

        # Check to see if we've cached the class instance for this name
        if controller in self.controller_classes:
            return self.controller_classes[controller]

        # Check to see if its a dotted name
        if '.' in controller or ':' in controller:
            mycontroller = pkg_resources.EntryPoint.parse(
                'x=%s' % controller).load(False)
            self.controller_classes[controller] = mycontroller
            return mycontroller

        # Pull the controllers class name, import controller
        full_module_name = self.package_name + '.controllers.' \
            + controller.replace('/', '.')

        # Hide the traceback here if the import fails (bad syntax and such)
        __traceback_hide__ = 'before_and_this'

        __import__(full_module_name)
        if hasattr(sys.modules[full_module_name], '__controller__'):
            mycontroller = getattr(sys.modules[full_module_name],
                sys.modules[full_module_name].__controller__)
        else:
            module_name = controller.split('/')[-1]
            class_name = class_name_from_module_name(module_name) + 'Controller'
            if self.log_debug:
                log.debug("Found controller, module: '%s', class: '%s'",
                          full_module_name, class_name)
            mycontroller = getattr(sys.modules[full_module_name], class_name)
        self.controller_classes[controller] = mycontroller
        return mycontroller
def find_controller ( self , controller ) : # If this isn't a basestring, its an object, assume that its the # proper instance to begin with if not isinstance ( controller , basestring ) : return controller # Check to see if we've cached the class instance for this name if controller in self . controller_classes : return self . controller_classes [ controller ] # Check to see if its a dotted name if '.' in controller or ':' in controller : mycontroller = pkg_resources . EntryPoint . parse ( 'x=%s' % controller ) . load ( False ) self . controller_classes [ controller ] = mycontroller return mycontroller # Pull the controllers class name, import controller full_module_name = self . package_name + '.controllers.' + controller . replace ( '/' , '.' ) # Hide the traceback here if the import fails (bad syntax and such) __traceback_hide__ = 'before_and_this' __import__ ( full_module_name ) if hasattr ( sys . modules [ full_module_name ] , '__controller__' ) : mycontroller = getattr ( sys . modules [ full_module_name ] , sys . modules [ full_module_name ] . __controller__ ) else : module_name = controller . split ( '/' ) [ - 1 ] class_name = class_name_from_module_name ( module_name ) + 'Controller' if self . log_debug : log . debug ( "Found controller, module: '%s', class: '%s'" , full_module_name , class_name ) mycontroller = getattr ( sys . modules [ full_module_name ] , class_name ) self . controller_classes [ controller ] = mycontroller return mycontroller