From 968ec84c82ec260b095f3c1b1a025c0f7665b42e Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 15 Jun 2021 18:35:42 +0200 Subject: [PATCH] generalize interfaces --- telecaster/context_processors.py | 4 +--- telecaster/tools/status.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) 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() -- 2.39.5