예제 #1
0
파일: WebDomo.py 프로젝트: rferrazz/WebDomo
 def __init__(self, plugins=[]):
     resource.Resource.__init__(self)
     self.pluginsManager = PluginsManager()
     for plugin in plugins:
         instances = self.pluginsManager.createModuleInstanceFromQuery("WHIA/Actuator", **plugin)
         for i in instances:
             self.putChild(i.name, i)
예제 #2
0
파일: WebDomo.py 프로젝트: rferrazz/WebDomo
class WebDomoServer(resource.Resource):
    def __init__(self, plugins=[]):
        resource.Resource.__init__(self)
        self.pluginsManager = PluginsManager()
        for plugin in plugins:
            instances = self.pluginsManager.createModuleInstanceFromQuery("WHIA/Actuator", **plugin)
            for i in instances:
                self.putChild(i.name, i)
            
    def render_GET(self, request):
        return json.dumps(self.children.keys())
    
    def getChild(self, path, request):
        if path == "":
            return self
        else:
            if path in self.children.keys():
                return resource.Resource.getChild(self, path, request)
            else:
                '''TODO: se master vedi se un qualche slave ha il plugin giusto e invia la richiesta'''
                return PageNotFoundError()