def dostuff(result): if result["start"]: name = UpdateManager.get_update(id=self.updateId).name print("update to download", name) UpdateManager.downloadAndInstall_update(name) else: print("uh oh")
def dostuff(result): if result["start"]: name=UpdateManager.get_update(id=self.updateId).name print("update to download",name) UpdateManager.downloadAndInstall_update(name) else: print("uh oh")
def render_GET(self, request): """ Handler for GET requests of updates' list """ r=ResponseGenerator(request,status=200,contentType="application/pollapli.updateList+json",resource="updates",rootUri=self.rootUri) d=RequestParser(request,"updates",self.valid_contentTypes,self.validGetParams).ValidateAndParseParams() d.addCallbacks(lambda params: UpdateManager.get_updates(params),errback=r._build_response) d.addBoth(r._build_response) request._call=reactor.callLater(0,d.callback,None) return NOT_DONE_YET
def render_DELETE(self, request): """ Handler for DELETE requests of addOns WARNING !! needs to be used very carefully, with confirmation on the client side, as it deletes all addons completely """ r = ResponseGenerator(request, status=200, rootUri=self.rootUri) d = UpdateManager.clear_addOns() d.addBoth(r._build_response) request._call = reactor.callLater(0, d.callback, None) return NOT_DONE_YET
def render_DELETE(self,request): """ Handler for DELETE requests of addOns WARNING !! needs to be used very carefully, with confirmation on the client side, as it deletes all addons completely """ r=ResponseGenerator(request,status=200,rootUri=self.rootUri) d=UpdateManager.clear_addOns() d.addBoth(r._build_response) request._call=reactor.callLater(0,d.callback,None) return NOT_DONE_YET
def setup(self): """configure all systems """ from twisted.enterprise import adbapi from twistar.registry import Registry envPath=os.path.join(EnvironmentManager.envPath,"home") dbPath=os.path.join(envPath,"home")+".db" Registry.DBPOOL = adbapi.ConnectionPool("sqlite3",database=dbPath,check_same_thread=False) """this is a required but very cheap hack: since twistard does not support multiple databases, we do not have a "master" database, which causes problems because of the dependencies, and initialization order of different elements, so for now, the "home" database is enforced""" yield UpdateManager.setup() yield DriverManager.setup() yield EnvironmentManager.setup() defer.returnValue(None)
def render_GET(self, request): """ Handler for GET requests for a single update """ r = ResponseGenerator(request, status=200, contentType="application/pollapli.update+json", resource="update", rootUri=self.rootUri) d = RequestParser(request, "update", self.valid_contentTypes, self.validGetParams).ValidateAndParseParams() d.addCallbacks( lambda params: UpdateManager.get_update(id=self.updateId), errback=r._build_response) d.addBoth(r._build_response) request._call = reactor.callLater(0, d.callback, None) return NOT_DONE_YET