def load_devices(self, environmentId = None ,*args,**kwargs): """Save the device object .""" lDevices = [] if environmentId is not None: rows = yield self.select(environmentId = str(environmentId), order = "id") else: rows = yield self.select(order = "id") for row in rows: id,name,description,status = row device = Device(name = name,description=description,status=status) device.cid = uuid.UUID(id) lDevices.append(device) defer.returnValue(lDevices)
def load_device(self, id=None, environmentId=None, *args, **kwargs): """Retrieve data from device object.""" if id is not None: rows = yield self.select(id=str(id)) elif environmentId is not None: rows = yield self.select(environmentId=str(environmentId)) result = None if len(rows) > 0: id, name, description, status = rows[0] result = Device(name=name, description=description, status=status) result.cid = uuid.UUID(id) else: raise DeviceNotFound() defer.returnValue(result)
def load_devices(self, environmentId=None, *args, **kwargs): """Save the device object .""" lDevices = [] if environmentId is not None: rows = yield self.select(environmentId=str(environmentId), order="id") else: rows = yield self.select(order="id") for row in rows: id, name, description, status = row device = Device(name=name, description=description, status=status) device.cid = uuid.UUID(id) lDevices.append(device) defer.returnValue(lDevices)
def load_device(self,id = None, environmentId = None ,*args,**kwargs): """Retrieve data from device object.""" if id is not None: rows = yield self.select(id = str(id)) elif environmentId is not None: rows = yield self.select(environmentId = str(environmentId)) result=None if len(rows)>0: id,name,description,status = rows[0] result = Device(name = name,description=description,status=status) result.cid = uuid.UUID(id) else: raise DeviceNotFound() defer.returnValue(result)