bug fix for device lists

This commit is contained in:
e20216 2022-09-16 17:39:21 +02:00
parent ffbdf205d0
commit c876e19eb7

View File

@ -84,13 +84,18 @@ class ScanGuard:
def _check_motors_movable(self, request) -> None: def _check_motors_movable(self, request) -> None:
if request.content["scan_type"] == "device_rpc": if request.content["scan_type"] == "device_rpc":
device = request.content["parameter"]["device"] device = request.content["parameter"]["device"]
if not self.device_manager.devices[device].enabled: if not isinstance(device, list):
raise ScanRejection(f"Device {device} is not enabled.") device = [device]
for dev in device:
if not self.device_manager.devices[dev].enabled:
raise ScanRejection(f"Device {dev} is not enabled.")
motor_args = request.content["parameter"].get("args") motor_args = request.content["parameter"].get("args")
if not motor_args: if not motor_args:
return return
for motor in motor_args: for motor in motor_args:
if not motor:
continue
if not self.device_manager.devices[motor].enabled: if not self.device_manager.devices[motor].enabled:
raise ScanRejection(f"Device {motor} is not enabled.") raise ScanRejection(f"Device {motor} is not enabled.")