File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1717# Date: 2024-08-14
1818# Description: module to keep track of WADAS version
1919
20- __version__ = "v0.9.14 "
20+ __version__ = "v0.9.15 "
2121__dbversion__ = __version__
Original file line number Diff line number Diff line change @@ -884,7 +884,31 @@ def domain_to_orm(domain_object, foreign_key=None):
884884 creation_date = get_precise_timestamp (),
885885 )
886886 elif isinstance (domain_object , ActuationEvent ):
887- cmd = DeterrentActuator .Commands (domain_object .command )
887+ actuator = Actuator .actuators .get (domain_object .actuator_id )
888+
889+ if actuator is None :
890+ logger .error (
891+ "Unable to find actuator ID '%s' in the pool of available actuators. Aborting." ,
892+ domain_object .actuator_id ,
893+ )
894+ return None
895+
896+ try :
897+ Commands = actuator .__class__ .Commands
898+ cmd = Commands (domain_object .command )
899+ except AttributeError :
900+ logger .error (
901+ "Actuator class %s does not define a Commands enum. Aborting." ,
902+ actuator .__class__ .__name__ ,
903+ )
904+ return None
905+ except ValueError :
906+ logger .error (
907+ "Invalid command '%s' for actuator class %s. Aborting." ,
908+ domain_object .command ,
909+ actuator .__class__ .__name__ ,
910+ )
911+ return None
888912
889913 return ORMActuationEvent (
890914 actuator_id = foreign_key [0 ],
You can’t perform that action at this time.
0 commit comments