[Sugar-devel] [PATCH 2/4] add model.network.find_connection_by_path

James Cameron quozl at laptop.org
Wed Apr 21 21:11:01 EDT 2010


Finds a connection given the path by which it is known to
NetworkManager, required since at least one caller doesn't have the
connection name available to them.
---
 src/jarabe/model/network.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 23b7472..e43dba0 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -490,6 +490,13 @@ def add_connection(ssid, settings, secrets=None):
     _nm_settings.add_connection(ssid, conn)
     return conn
 
+def find_connection_by_path(path):
+    connections = get_settings().connections
+    for conn in connections.values():
+        if conn.path == path:
+            return conn
+    return None
+
 def load_connections():
     profile_path = env.get_profile_path()
     config_path = os.path.join(profile_path, 'nm', 'connections.cfg')
-- 
1.7.0


-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list