On 12/18/2018 08:44 AM, Marc Hartmayer wrote:
This makes it's easier to understand the code.

Signed-off-by: Marc Hartmayer <[email protected]>
Reviewed-by: Boris Fiuczynski <[email protected]>
---
  virtinst/domain/os.py | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index c6e49f80a432..d0a73f63dfbd 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -67,17 +67,20 @@ class DomainOs(XMLBuilder):
                         "nvram", "nvram_template", "kernel", "initrd",
                         "kernel_args", "dtb", "_bootdevs", "smbios_mode"]
- def _get_bootorder(self):
+    _bootdevs = XMLChildProperty(_BootDevice)
+
+    @property
+    def bootorder(self):
          return [dev.dev for dev in self._bootdevs]
-    def _set_bootorder(self, newdevs):
+
+    @bootorder.setter
+    def bootorder(self, newdevs):
          for dev in self._bootdevs:
              self.remove_child(dev)
for d in newdevs:
              dev = self._bootdevs.add_new()
              dev.dev = d
-    _bootdevs = XMLChildProperty(_BootDevice)
-    bootorder = property(_get_bootorder, _set_bootorder)
initargs = XMLChildProperty(_InitArg)
      def set_initargs_string(self, argstring):


Eh I know this is more typical python convention but I certainly don't find it more readable. Plus we have 0 usages of property.setter in the code and 50+ usages of property(), so I'm skipping this patch

Thanks,
Cole

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to