mirror of
https://github.com/paulscherrerinstitute/sf_daq_broker.git
synced 2026-05-01 11:22:22 +02:00
added and use get_validated_detector_name_and_beamline
This commit is contained in:
@@ -141,14 +141,7 @@ class BrokerManager:
|
||||
|
||||
|
||||
def power_on_detector(self, request, remote_ip):
|
||||
validate.request_has(request, "detector_name")
|
||||
|
||||
beamline = get_beamline(remote_ip)
|
||||
allowed_detectors_beamline = get_configured_detectors(beamline)
|
||||
|
||||
detector_name = request["detector_name"]
|
||||
|
||||
validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline)
|
||||
detector_name, beamline = validate.get_validated_detector_name_and_beamline(request, remote_ip)
|
||||
|
||||
request_power_on = {
|
||||
"beamline": beamline,
|
||||
|
||||
@@ -8,7 +8,6 @@ from sf_daq_broker.config import CONFIG_FILENAME_TIME_FORMAT
|
||||
from sf_daq_broker.detector.jfctrl import JFCtrl
|
||||
from sf_daq_broker.detector.detector import Detector
|
||||
from sf_daq_broker.detector.trigger import Trigger
|
||||
from sf_daq_broker.detector.utils import get_configured_detectors
|
||||
from sf_daq_broker.utils import get_beamline, json_save, json_load, dueto, parse_det_name
|
||||
from . import validate
|
||||
|
||||
@@ -109,13 +108,9 @@ class DetectorManager:
|
||||
|
||||
|
||||
def set_detector_settings(self, request, remote_ip):
|
||||
validate.request_has(request, "detector_name", "parameters")
|
||||
validate.request_has(request, "parameters")
|
||||
|
||||
beamline = get_beamline(remote_ip)
|
||||
allowed_detectors_beamline = get_configured_detectors(beamline)
|
||||
|
||||
detector_name = request["detector_name"]
|
||||
validate.detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline)
|
||||
detector_name, beamline = validate.get_validated_detector_name_and_beamline(request, remote_ip)
|
||||
|
||||
detector = Detector(detector_name)
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ def detectors(ds):
|
||||
|
||||
|
||||
def get_validated_detector_name(request, remote_ip):
|
||||
detector_name, _beamline = get_validated_detector_name_and_beamline(request, remote_ip)
|
||||
return detector_name
|
||||
|
||||
|
||||
def get_validated_detector_name_and_beamline(request, remote_ip):
|
||||
request_has(request, "detector_name")
|
||||
|
||||
beamline = get_beamline(remote_ip)
|
||||
@@ -31,7 +36,8 @@ def get_validated_detector_name(request, remote_ip):
|
||||
detector_name = request["detector_name"]
|
||||
detector_name_in_allowed_detectors_beamline(detector_name, allowed_detectors_beamline, beamline)
|
||||
|
||||
return detector_name
|
||||
return detector_name, beamline
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user