From: Guillaume Pellerin Date: Tue, 15 Jun 2021 16:35:42 +0000 (+0200) Subject: generalize interfaces X-Git-Tag: 0.9~7 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=968ec84c82ec260b095f3c1b1a025c0f7665b42e;p=telecaster-client.git generalize interfaces --- diff --git a/telecaster/context_processors.py b/telecaster/context_processors.py index ece4dd0..649127a 100644 --- a/telecaster/context_processors.py +++ b/telecaster/context_processors.py @@ -37,9 +37,7 @@ from django.conf import settings import socket import fcntl import struct - -interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8', 'eth9', - 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4'] +from .tools.status import interfaces def get_ip_address(ifname): diff --git a/telecaster/tools/status.py b/telecaster/tools/status.py index 2ee33fe..9ecf913 100644 --- a/telecaster/tools/status.py +++ b/telecaster/tools/status.py @@ -40,13 +40,17 @@ from telecaster.tools import * from django.conf import settings -class Status(object): +interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', 'eth5', + 'eth6', 'eth7', 'eth8', 'eth9', 'eno0', 'eno1', + 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4'] + +acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'} - interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'eth4', 'eth5', - 'eth6', 'eth7', 'eth8', 'eth9', 'eno0', 'eno1', - 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'wlan4'] - acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'} +class Status(object): + + interfaces = interfaces + acpi_states = acpi_states def __init__(self): self.acpi = acpi.Acpi()