Subject: manager: Properly show domain names with reserved XML characters From: Cole Robinson crobinso@redhat.com Mon Aug 29 12:11:43 2011 -0400 Date: Mon Aug 29 12:11:43 2011 -0400: Git: 8a513361522780fcc126ec2ded48839ecc24ef6e Index: virt-manager-0.9.0/src/virtManager/delete.py =================================================================== --- virt-manager-0.9.0.orig/src/virtManager/delete.py +++ virt-manager-0.9.0/src/virtManager/delete.py @@ -91,7 +91,7 @@ class vmmDeleteDialog(vmmGObjectUI): # Set VM name in title' title_str = ("%s '%s'" % - (_("Delete"), self.vm.get_name())) + (_("Delete"), util.xml_escape(self.vm.get_name()))) self.widget("delete-main-label").set_markup(title_str) self.widget("delete-cancel").grab_focus() Index: virt-manager-0.9.0/src/virtManager/manager.py =================================================================== --- virt-manager-0.9.0.orig/src/virtManager/manager.py +++ virt-manager-0.9.0/src/virtManager/manager.py @@ -701,12 +701,12 @@ class vmmManager(vmmGObjectUI): return hint def _build_conn_markup(self, conn, row): + name = util.xml_escape(row[ROW_NAME]) + text = name if conn.state == conn.STATE_DISCONNECTED: - text = str(row[ROW_NAME]) + " - " + _("Not Connected") + text += " - " + _("Not Connected") elif conn.state == conn.STATE_CONNECTING: - text = str(row[ROW_NAME]) + " - " + _("Connecting...") - else: - text = str(row[ROW_NAME]) + text += " - " + _("Connecting...") markup = "%s" % text return markup @@ -720,7 +720,7 @@ class vmmManager(vmmGObjectUI): def _build_vm_markup(self, row): domtext = ("%s" % - row[ROW_NAME]) + util.xml_escape(row[ROW_NAME])) statetext = "%s" % row[ROW_STATUS] return domtext + "\n" + statetext Index: virt-manager-0.9.0/src/virtManager/migrate.py =================================================================== --- virt-manager-0.9.0.orig/src/virtManager/migrate.py +++ virt-manager-0.9.0/src/virtManager/migrate.py @@ -122,7 +122,7 @@ class vmmMigrateDialog(vmmGObjectUI): def reset_state(self): title_str = ("%s '%s'" % - (_("Migrate"), self.vm.get_name())) + (_("Migrate"), util.xml_escape(self.vm.get_name()))) self.widget("migrate-main-label").set_markup(title_str) self.widget("migrate-cancel").grab_focus() Index: virt-manager-0.9.0/src/virtManager/util.py =================================================================== --- virt-manager-0.9.0.orig/src/virtManager/util.py +++ virt-manager-0.9.0/src/virtManager/util.py @@ -29,6 +29,8 @@ import virtinst running_config = None +xml_escape = virtinst.util.xml_escape + # FIXME: selinux policy also has a ~/VirtualMachines/isos dir def get_default_pool_path(conn): if conn.is_session_uri():