def render_GET_advanced(self, request, response): #enviar mensagem padrao de funcionando self.payload = request.payload logger.debug("\ndentro do get ") #,self.payload) request.parame assert (isinstance(response, Response)) response.mid = request.mid defines.acknowledged = True caminhos = request.uri_path.split("/") if caminhos[1] == "save": DBRegister.saveToFile("./registro.txt") response.payload = "dados salvos" self.payload = "dados salvos" response.code = defines.Codes.CREATED.number #CREATED.number print("dentro do save") elif caminhos[1] == "load": DBRegister.loadFromFile("./registro.txt") response.payload = "dados carregados" self.payload = "dados carregados" response.code = defines.Codes.CREATED.number #CREATED.number print("dentro do load") else: logger.debug("opcao invalida") response.code = defines.Codes.NOT_IMPLEMENTED.number #CREATED.number return self, response
def render_DELETE(self, request): logger.debug("\ndentro do DELETE") DBRegister.loadFromFile("./registro.txt") response.payload = "dados carregados" self.payload = "dados carregados" response.code = defines.Codes.CREATED.number return True