tango.server.device_property does not parse boolean properties
Consider the following device server:
```python
import tango
from tango import server as tgsrv
class MyDevice(tgsrv.Device):
int_prop = tgsrv.device_property(dtype=(int,))
bool_prop = tgsrv.device_property(dtype=(bool,))
@tgsrv.attribute(max_dim_x=2)
def intAttr(self) -> list[int]:
return self.int_prop
@tgsrv.attribute(max_dim_x=2)
def boolAttr(self) -> list[bool]:
return self.bool_prop
if __name__ == '__main__':
tgsrv.run((MyDevice,))
```
And let's say I've made a mistake and missed some quotes when I added the properties to the database:
```
In [3]: db.get_device_property("foo/bar/1", ["int_prop", "bool_prop"])
Out[3]: {'int_prop': ['1, 2'], 'bool_prop': ['true, true']}
```
If I start the device server with this in my database then I get the following exception and the device server fails to start:
```
mydevice-1 | Exiting: Server exited with tango.DevFailed:
mydevice-1 | DevFailed[
mydevice-1 | DevError[
mydevice-1 | desc = ValueError: invalid literal for int() with base 10: '1, 2'
mydevice-1 | origin = Traceback (most recent call last):
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/device_class.p
y", line 659, in __DeviceClass__device_factory
mydevice-1 | device = self._new_device(deviceImplClass, klass, dev_name
)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/device_class.p
y", line 638, in __DeviceClass__new_device
mydevice-1 | return klass(dev_class, dev_name)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/server.py", li
ne 835, in __init__
mydevice-1 | self.init_device()
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/server.py", li
ne 433, in init_device
mydevice-1 | return worker.execute(init_device_orig, self)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/green.py", lin
e 110, in execute
mydevice-1 | return fn(*args, **kwargs)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/server.py", li
ne 854, in init_device
mydevice-1 | self.get_device_properties()
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/server.py", li
ne 893, in get_device_properties
mydevice-1 | pu.get_device_properties(self, class_prop, self.device_pro
perty_list)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/device_class.p
y", line 151, in get_device_properties
mydevice-1 | values = self.stringArray2values(prop_value, data_type)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/device_class.p
y", line 277, in stringArray2values
mydevice-1 | return seqStr_2_obj(argin, argout_type)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/utils.py", lin
e 1185, in seqStr_2_obj
mydevice-1 | return _seqStr_2_obj_from_type(seq, tg_type)
mydevice-1 | File "/app/lib/python3.10/site-packages/tango/utils.py", lin
e 1216, in _seqStr_2_obj_from_type
mydevice-1 | argout.append(int(x))
mydevice-1 | ValueError: invalid literal for int() with base 10: '1, 2'
mydevice-1 | reason = PyDs_PythonError
mydevice-1 | severity = ERR
mydevice-1 | ]
mydevice-1 | ]
mydevice-1 |
mydevice-1 | Exited
```
Although it would be nice for this error message to tell me which property (and device) has this problem, at least it tells me there is a problem with my device server configuration.
However, if fix this error for `int_prop` then the device server starts without complaining, despite the same error existing for `bool_prop`. What has happened in this case? Our "true, true" string gets interpreted as `False`:
```
In [14]: dp.intAttr
Out[14]: array([1, 2])
In [15]: dp.boolAttr
Out[15]: array([False])
```
The issue is that we are [just testing against "true"](https://gitlab.com/tango-controls/pytango/-/blob/246a17244225cbd3ffaaae3868f3b62344989742/tango/utils.py#L1206-1207) when we convert to a boolean rather than validating that the string we got really does represent a boolean.
Please can we only accept "true"/"false" here and raise an exception in other cases?
issue