From ebeaefc4cbf6b16d29b18ab20713f0bfcd6e265f Mon Sep 17 00:00:00 2001 From: Giuseppe Carboni Date: Thu, 16 May 2024 15:45:50 +0200 Subject: [PATCH] Fix #868, replaced `.getchildren()` with `list()` --- Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py | 3 +-- .../Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py | 4 ++-- Common/Tests/test/cdb/test_procedures.py | 2 +- .../src/IFDistributor14/SRTIFDistributor14Impl.py | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py index 099156d30..389f52ab9 100644 --- a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py +++ b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py @@ -197,8 +197,7 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): raise exc try: - children = ElementTree.fromstring(dao).getchildren() - for child in children: + for child in list(ElementTree.fromstring(dao)): backend, channel, polarity = [c.text.strip() for c in child] backend = backend.lower() value = (int(channel), int(polarity)) diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py index e0c3ec63b..e31369e9e 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py @@ -210,7 +210,7 @@ class CDBConf(object): try: dal = ACSCorba.cdb() dao = dal.get_DAO(path) - children = ElementTree.fromstring(dao).getchildren() + children = list(ElementTree.fromstring(dao)) except cdbErrType.CDBRecordDoesNotExistEx: raeson = "CDB record %s does not exists" %path logger.logError(raeson) @@ -218,7 +218,7 @@ class CDBConf(object): exc.setReason(raeson) raise exc except Exception as ex: - children = () + children = [] setattr(self, dictName, {}) d = getattr(self, dictName) diff --git a/Common/Tests/test/cdb/test_procedures.py b/Common/Tests/test/cdb/test_procedures.py index fa6c6b3fd..690667552 100644 --- a/Common/Tests/test/cdb/test_procedures.py +++ b/Common/Tests/test/cdb/test_procedures.py @@ -7,7 +7,7 @@ class TestProcedures(unittest.TestCase): def setUp(self): dal = ACSCorba.cdb() dao = dal.get_DAO('alma/Procedures/StationProcedures') - self.procedures = ElementTree.fromstring(dao).getchildren() + self.procedures = list(ElementTree.fromstring(dao)) def test_reset_not_allowed_in_setup(self): """Vefify the setup does not execute the antennaReset command""" diff --git a/SRT/Servers/SRTPyIFDistributor14/src/IFDistributor14/SRTIFDistributor14Impl.py b/SRT/Servers/SRTPyIFDistributor14/src/IFDistributor14/SRTIFDistributor14Impl.py index c292225d7..f5ffae436 100644 --- a/SRT/Servers/SRTPyIFDistributor14/src/IFDistributor14/SRTIFDistributor14Impl.py +++ b/SRT/Servers/SRTPyIFDistributor14/src/IFDistributor14/SRTIFDistributor14Impl.py @@ -210,8 +210,7 @@ class SRTIFDistributor14Impl(SRTIFDistributor14, cc, services, lcycle): raise exc try: - children = ElementTree.fromstring(dao).getchildren() - for child in children: + for child in list(ElementTree.fromstring(dao)) backend, channel, address = [c.text.strip() for c in child] value = {int(channel): int(address)} if backend in self.mapping: -- GitLab