From d684bac0ab68cf40a7c8f07850012c0f133cfc78 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 1 Aug 2009 18:57:00 -0400 Subject: [PATCH] Fix some minor formatting issues Don't save wired profiles that have only whitespace in their names. --- wicd/wicd-daemon.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index ae38208..52f8619 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -84,7 +84,7 @@ class WicdDaemon(dbus.service.Object): self._debug_mode = bool(self.config.get("Settings", "debug_mode")) self.wifi = networking.Wireless(debug=self._debug_mode) self.wired = networking.Wired(debug=self._debug_mode) - self.wired_bus= WiredDaemon(bus_name, self, wired=self.wired) + self.wired_bus = WiredDaemon(bus_name, self, wired=self.wired) self.wireless_bus = WirelessDaemon(bus_name, self, wifi=self.wifi) self.forced_disconnect = False self.need_profile_chooser = False @@ -518,7 +518,7 @@ class WicdDaemon(dbus.service.Object): # 1 = default profile # 2 = show list # 3 = last used profile - self.config.set("Settings","wired_connect_mode", int(method), + self.config.set("Settings", "wired_connect_mode", int(method), write=True) self.wired_connect_mode = int(method) self.wired_bus.connect_mode = int(method) @@ -856,7 +856,7 @@ class WicdDaemon(dbus.service.Object): """ b_wired = self.wired_bus b_wifi = self.wireless_bus - app_conf= self.config + app_conf = self.config # Load the backend. be_def = 'external' self.SetBackend(app_conf.get("Settings", "backend", default=be_def)) @@ -880,7 +880,7 @@ class WicdDaemon(dbus.service.Object): dns1 = app_conf.get("Settings", "global_dns_1", default='None') dns2 = app_conf.get("Settings", "global_dns_2", default='None') dns3 = app_conf.get("Settings", "global_dns_3", default='None') - dns_dom =app_conf.get("Settings", "global_dns_dom", default='None') + dns_dom = app_conf.get("Settings", "global_dns_dom", default='None') search_dom = app_conf.get("Settings", "global_search_dom", default='None') self.SetGlobalDNS(dns1, dns2, dns3, dns_dom, search_dom) self.SetAutoReconnect(app_conf.get("Settings", "auto_reconnect", @@ -1448,7 +1448,7 @@ class WiredDaemon(dbus.service.Object): if self.config.has_section(profilename): return False - for option in ["ip", "broadcast", "netmask","gateway", "search_domain", + for option in ["ip", "broadcast", "netmask", "gateway", "search_domain", "dns_domain", "dns1", "dns2", "dns3", "beforescript", "afterscript", "predisconnectscript", "postdisconnectscript"]: @@ -1506,8 +1506,10 @@ class WiredDaemon(dbus.service.Object): if not self.config.has_option(prof, script): self.config.set(prof, script, None) - if profilename == "": + profilename = profilename.strip() + if not profilename: self.config.write() + print "Warning: Bad wired profile name given, ignoring." return "500: Bad Profile name" if self.debug_mode: print "saving wired profile %s" % profilename