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")
|
||||
|
||||
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={}):
|
||||
from yunohost.hook import hook_exec
|
||||
|
|
|
@ -81,10 +81,11 @@ class ConfigPanel:
|
|||
key = f"{panel['id']}.{section['id']}.{option['id']}"
|
||||
if mode == 'export':
|
||||
result[option['id']] = option.get('current_value')
|
||||
elif 'ask' in option:
|
||||
result[key] = {'ask': _value_for_locale(option['ask'])}
|
||||
elif 'i18n' in self.config:
|
||||
result[key] = {'ask': m18n.n(self.config['i18n'] + '_' + option['id'])}
|
||||
else:
|
||||
if 'ask' in option:
|
||||
result[key] = {'ask': _value_for_locale(option['ask'])}
|
||||
elif 'i18n' in self.config:
|
||||
result[key] = {'ask': m18n.n(self.config['i18n'] + '_' + option['id'])}
|
||||
if 'current_value' in option:
|
||||
question_class = ARGUMENTS_TYPE_PARSERS[option.get("type", "string")]
|
||||
result[key]['value'] = question_class.humanize(option['current_value'], option)
|
||||
|
@ -774,7 +775,7 @@ class FileQuestion(Question):
|
|||
|
||||
def __init__(self, question, user_answers):
|
||||
super().__init__(question, user_answers)
|
||||
if self.get("accept"):
|
||||
if question.get("accept"):
|
||||
self.accept = question.get("accept").replace(" ", "").split(",")
|
||||
else:
|
||||
self.accept = []
|
||||
|
|
Loading…
Add table
Reference in a new issue