mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Get / set app config panel
This commit is contained in:
parent
8eaaf0975a
commit
4c9fcdc9e4
2 changed files with 8 additions and 6 deletions
|
@ -1800,7 +1800,8 @@ class AppConfigPanel(ConfigPanel):
|
||||||
self.values = self._call_config_script("show")
|
self.values = self._call_config_script("show")
|
||||||
|
|
||||||
def _apply(self):
|
def _apply(self):
|
||||||
self.errors = self._call_config_script("apply", self.new_values)
|
env = {key: str(value) for key, value in self.new_values.items()}
|
||||||
|
self.errors = self._call_config_script("apply", env=env)
|
||||||
|
|
||||||
def _call_config_script(self, action, env={}):
|
def _call_config_script(self, action, env={}):
|
||||||
from yunohost.hook import hook_exec
|
from yunohost.hook import hook_exec
|
||||||
|
|
|
@ -81,7 +81,8 @@ class ConfigPanel:
|
||||||
key = f"{panel['id']}.{section['id']}.{option['id']}"
|
key = f"{panel['id']}.{section['id']}.{option['id']}"
|
||||||
if mode == 'export':
|
if mode == 'export':
|
||||||
result[option['id']] = option.get('current_value')
|
result[option['id']] = option.get('current_value')
|
||||||
elif 'ask' in option:
|
else:
|
||||||
|
if 'ask' in option:
|
||||||
result[key] = {'ask': _value_for_locale(option['ask'])}
|
result[key] = {'ask': _value_for_locale(option['ask'])}
|
||||||
elif 'i18n' in self.config:
|
elif 'i18n' in self.config:
|
||||||
result[key] = {'ask': m18n.n(self.config['i18n'] + '_' + option['id'])}
|
result[key] = {'ask': m18n.n(self.config['i18n'] + '_' + option['id'])}
|
||||||
|
@ -774,7 +775,7 @@ class FileQuestion(Question):
|
||||||
|
|
||||||
def __init__(self, question, user_answers):
|
def __init__(self, question, user_answers):
|
||||||
super().__init__(question, user_answers)
|
super().__init__(question, user_answers)
|
||||||
if self.get("accept"):
|
if question.get("accept"):
|
||||||
self.accept = question.get("accept").replace(" ", "").split(",")
|
self.accept = question.get("accept").replace(" ", "").split(",")
|
||||||
else:
|
else:
|
||||||
self.accept = []
|
self.accept = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue