From 3829512e3d1808c52eb1ba1329be19d7b97f582b Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 8 Mar 2019 02:08:44 +0100 Subject: [PATCH 4/9] environment: rename get_setting_variable to get_variable (#29240) --- hobo/environment/forms.py | 6 +++--- hobo/environment/utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hobo/environment/forms.py b/hobo/environment/forms.py index 00e1977..b07a8a3 100644 --- a/hobo/environment/forms.py +++ b/hobo/environment/forms.py @@ -24,7 +24,7 @@ from django.utils.translation import ugettext_lazy as _ from .models import (Authentic, Wcs, Passerelle, Variable, Combo, Fargo, Welco, MandayeJS, Chrono, Corbo, BiJoe, Hobo) -from .utils import get_setting_variable +from .utils import get_variable EXCLUDED_FIELDS = ('last_operational_check_timestamp', 'last_operational_success_timestamp', 'secret_key', @@ -185,7 +185,7 @@ class VariablesFormMixin(object): form_data = None initial_data = {} for variable_name in self.variables: - initial_data[variable_name] = get_setting_variable(variable_name).value + initial_data[variable_name] = get_variable(variable_name).value context['form'] = self.form_class(form_data, initial=initial_data) return context @@ -195,7 +195,7 @@ class VariablesFormMixin(object): return self.get(request, *args, **kwargs) changed = False for variable_name in self.variables: - variable = get_setting_variable(variable_name) + variable = get_variable(variable_name) if variable.value != form.cleaned_data[variable_name]: variable.value = form.cleaned_data[variable_name] variable.save() diff --git a/hobo/environment/utils.py b/hobo/environment/utils.py index b8de46f..537c865 100644 --- a/hobo/environment/utils.py +++ b/hobo/environment/utils.py @@ -70,7 +70,7 @@ class Zone: self.href = href -def get_setting_variable(name): +def get_variable(name): from .models import Variable variable, created = Variable.objects.get_or_create( name=name, -- 2.20.1