prevent json layout and profile from being saved to the global config file
This commit is contained in:
parent
42b1915065
commit
b669996180
|
@ -696,14 +696,20 @@ class ConfigBase(Borg):
|
||||||
section = getattr(self, section_name)
|
section = getattr(self, section_name)
|
||||||
parser[section_name] = dict_diff(DEFAULTS[section_name], section)
|
parser[section_name] = dict_diff(DEFAULTS[section_name], section)
|
||||||
|
|
||||||
|
from .configjson import JSON_PROFILE_NAME, JSON_LAYOUT_NAME
|
||||||
|
|
||||||
parser['profiles'] = {}
|
parser['profiles'] = {}
|
||||||
for profile in self.profiles:
|
for profile in self.profiles:
|
||||||
|
if profile == JSON_PROFILE_NAME:
|
||||||
|
continue
|
||||||
dbg('ConfigBase::save: Processing profile: %s' % profile)
|
dbg('ConfigBase::save: Processing profile: %s' % profile)
|
||||||
parser['profiles'][profile] = dict_diff(
|
parser['profiles'][profile] = dict_diff(
|
||||||
DEFAULTS['profiles']['default'], self.profiles[profile])
|
DEFAULTS['profiles']['default'], self.profiles[profile])
|
||||||
|
|
||||||
parser['layouts'] = {}
|
parser['layouts'] = {}
|
||||||
for layout in self.layouts:
|
for layout in self.layouts:
|
||||||
|
if layout == JSON_LAYOUT_NAME:
|
||||||
|
continue
|
||||||
dbg('ConfigBase::save: Processing layout: %s' % layout)
|
dbg('ConfigBase::save: Processing layout: %s' % layout)
|
||||||
parser['layouts'][layout] = self.layouts[layout]
|
parser['layouts'][layout] = self.layouts[layout]
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,10 @@ import json
|
||||||
import copy
|
import copy
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
|
JSON_PROFILE_NAME = "__internal_json_profile__"
|
||||||
|
JSON_LAYOUT_NAME = "__internal_json_layout__"
|
||||||
|
|
||||||
class ConfigJson(object):
|
class ConfigJson(object):
|
||||||
JSON_PROFILE_NAME = "__internal_json_profile__"
|
|
||||||
JSON_LAYOUT_NAME = "__internal_json_layout__"
|
|
||||||
|
|
||||||
profile_to_use = 'default'
|
profile_to_use = 'default'
|
||||||
|
|
||||||
|
@ -158,13 +159,13 @@ class ConfigJson(object):
|
||||||
if 'profile' in configjson:
|
if 'profile' in configjson:
|
||||||
profile = self.get_profile(configjson['profile'], config.base.profiles['default'])
|
profile = self.get_profile(configjson['profile'], config.base.profiles['default'])
|
||||||
if profile:
|
if profile:
|
||||||
config.base.profiles[self.JSON_PROFILE_NAME] = profile
|
config.base.profiles[JSON_PROFILE_NAME] = profile
|
||||||
self.profile_to_use = self.JSON_PROFILE_NAME
|
self.profile_to_use = JSON_PROFILE_NAME
|
||||||
|
|
||||||
if 'layout' in configjson:
|
if 'layout' in configjson:
|
||||||
layout = self.get_layout(configjson['layout'])
|
layout = self.get_layout(configjson['layout'])
|
||||||
if layout:
|
if layout:
|
||||||
config.base.layouts[self.JSON_LAYOUT_NAME] = layout
|
config.base.layouts[JSON_LAYOUT_NAME] = layout
|
||||||
return self.JSON_LAYOUT_NAME
|
return JSON_LAYOUT_NAME
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue