network: Fix showing wifi connection

Viewing a wifi connection will cause a 500 error.  To reproduce this
issue, go to plinth/sys/networks/.  If no wifi connections exist,
add one use the "Add Connection" button.  Then, click on the name of
the wifi connection to view it.  A 500 error is returned.

This commit fixes this error so the normal "show connection" is
returned.  It also fixes a bytestring conversion error
for the SSID and a blank value for "mode" on the page.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Jim Gregory 2022-03-18 16:04:09 -05:00 committed by Sunil Mohan Adapa
parent 5ea78f6e28
commit 66e19ff56e
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 6 additions and 3 deletions

View File

@ -146,7 +146,7 @@
</div>
<div class="list-group-item">
<span class="primary">{% trans "Mode" %}</span>
<span class="secondary">{{ device.wireless.mode_string }}</span>
<span class="secondary">{{ connection.wireless.mode_string }}</span>
</div>
{% endif %}
{% if access_point.channel %}

View File

@ -187,7 +187,8 @@ def show(request, uuid):
device, connection_status['wireless']['ssid'])
connection_status['wireless'][
'mode_string'] = WIRELESS_MODE_STRINGS.get(
connection['wireless']['mode'], connection['wireless']['mode'])
connection_status['wireless']['mode'],
connection_status['wireless']['mode'])
return TemplateResponse(
request, 'connection_show.html', {

View File

@ -111,7 +111,9 @@ def get_status_from_connection(connection):
if status['type'] == '802-11-wireless':
setting_wireless = connection.get_setting_wireless()
status['wireless']['ssid'] = setting_wireless.get_ssid().get_data()
status['wireless']['ssid'] = setting_wireless.get_ssid().get_data(
).decode()
status['wireless']['mode'] = setting_wireless.get_mode()
return status