diff --git a/INSTALL b/INSTALL index 45f30f9f2..d7404b529 100644 --- a/INSTALL +++ b/INSTALL @@ -6,8 +6,9 @@ $ sudo apt-get install libjs-jquery libjs-modernizr \ libjs-bootstrap make pandoc python3 python3-cherrypy3 \ - python3-coverage python3-django python3-bootstrapform \ - python3-gi python3-setuptools python3-yaml gir1.2-packagekitglib-1.0 + python3-coverage python3-dbus python3-django python3-bootstrapform \ + python3-gi python3-networkmanager python3-setuptools python3-yaml \ + gir1.2-packagekitglib-1.0 2. Install Plinth: diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py index cb1c5f8e9..40d38b4d4 100644 --- a/plinth/modules/networks/networks.py +++ b/plinth/modules/networks/networks.py @@ -117,14 +117,17 @@ def edit(request, conn_id): form_data['ipv4_address'] = settings['ipv4']['addresses'][0][0] if settings['connection']['type'] == '802-11-wireless': - form_data['ssid'] = settings['802-11-wireless']['ssid'] - form_data['mode'] = settings['802-11-wireless']['mode'] + settings_wifi = settings['802-11-wireless'] + form_data['ssid'] = settings_wifi['ssid'] + form_data['mode'] = settings_wifi['mode'] try: - if (settings['802-11-wireless']['security'] == '802-11-wireless-security' - and settings['802-11-wireless-security']['key-mgmt'] == 'wpa-psk'): - form_data['auth_mode'] = 'wpa' - secrets = conn.GetSecrets() - form_data['passphrase'] = secrets['802-11-wireless-security']['psk'] + if settings_wifi['security'] == '802-11-wireless-security': + wifi_sec = settings['802-11-wireless-security'] + if wifi_sec['key-mgmt'] == 'wpa-psk': + form_data['auth_mode'] = 'wpa' + secret = conn.GetSecrets() + psk = secret['802-11-wireless-security']['psk'] + form_data['passphrase'] = psk else: form_data['auth_mode'] = 'open' except KeyError: diff --git a/plinth/modules/networks/urls.py b/plinth/modules/networks/urls.py index 7799da764..335fe361e 100644 --- a/plinth/modules/networks/urls.py +++ b/plinth/modules/networks/urls.py @@ -32,7 +32,8 @@ urlpatterns = patterns( url(r'^sys/networks/(?P[\w.@+-]+)/deactivate/$', 'deactivate', name='deactivate'), url(r'^sys/networks/scan/$', 'scan', name='scan'), - url(r'^sys/networks/connect/(?P[\w.@+-]+)/$', 'connect', name='connect'), + url(r'^sys/networks/connect/(?P[\w.@+-]+)/$', + 'connect', name='connect'), url(r'^sys/networks/add/$', 'add', name='add'), url(r'^sys/networks/add/ethernet/$', 'add_ethernet', name='add_ethernet'), url(r'^sys/networks/add/wifi/$', 'add_wifi', name='add_wifi'), diff --git a/plinth/network.py b/plinth/network.py index f8156337a..05093d6cd 100644 --- a/plinth/network.py +++ b/plinth/network.py @@ -35,6 +35,7 @@ CONNECTION_TYPE_NAMES = { class ConnectionNotFound(Exception): def __init__(self, msg): self.msg = msg + def __str__(self): return self.msg @@ -42,6 +43,7 @@ class ConnectionNotFound(Exception): class DeviceNotFound(Exception): def __init__(self, msg): self.msg = msg + def __str__(self): return self.msg @@ -179,8 +181,8 @@ def activate_connection(name): }.get(ctype, ctype) for dev in NetworkManager.NetworkManager.GetDevices(): - if (dev.DeviceType == dtype - and dev.State == NetworkManager.NM_DEVICE_STATE_DISCONNECTED): + if (dev.DeviceType == dtype and + dev.State == NetworkManager.NM_DEVICE_STATE_DISCONNECTED): break else: raise DeviceNotFound(