Esempio n. 1
0
    def findServiceEndpoint(self, name):
        """Overrides ServiceHandler.findServiceEndpoint to first check plugins.
        
        If a plugin is not found that matches the service endpoint then the
        base method is called.
        
        """

        for plugin in self.service_plugins.extensions(self.env):
            sh = ServiceHolder(plugin)
            if name.startswith(sh.name) and name[len(sh.name)] == '.':
                return sh

        return ServiceHandler.findServiceEndpoint(self, name)
Esempio n. 2
0
    def findServiceEndpoint(self, name):
        req = self.req

        (modulePath, fileName) = os.path.split(req.filename)
        (moduleName, ext) = os.path.splitext(fileName)
        
        if not os.path.exists(os.path.join(modulePath, moduleName + ".py")):
            raise ServiceImplementaionNotFound()
        else:
            if not modulePath in sys.path:
                sys.path.insert(0, modulePath)

            from mod_python import apache
            module = apache.import_module(moduleName, log=1)
            
            if hasattr(module, "service"):
                self.service = module.service
            elif hasattr(module, "Service"):
                self.service = module.Service()
            else:
                self.service = module

        return ServiceHandler.findServiceEndpoint(self, name)
Esempio n. 3
0
    def findServiceEndpoint(self, name):
        req = self.req

        (modulePath, fileName) = os.path.split(req.filename)
        (moduleName, ext) = os.path.splitext(fileName)

        if not os.path.exists(os.path.join(modulePath, moduleName + ".py")):
            raise ServiceImplementaionNotFound()
        else:
            if not modulePath in sys.path:
                sys.path.insert(0, modulePath)

            from mod_python import apache
            module = apache.import_module(moduleName, log=1)

            if hasattr(module, "service"):
                self.service = module.service
            elif hasattr(module, "Service"):
                self.service = module.Service()
            else:
                self.service = module

        return ServiceHandler.findServiceEndpoint(self, name)