corrections
This commit is contained in:
parent
9e614eb7a4
commit
75778cb39e
2 changed files with 32 additions and 4 deletions
|
@ -28,7 +28,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from tiramisu import Config
|
||||
from copy import copy
|
||||
from warnings import warn
|
||||
|
||||
from .convert import RougailConvert
|
||||
from .config import RougailConfig
|
||||
|
@ -69,7 +69,7 @@ class Rougail:
|
|||
"""Add a prefix"""
|
||||
self.converted.parse_directories(path_prefix)
|
||||
|
||||
def get_config(self):
|
||||
def run(self):
|
||||
"""Get Tiramisu Config"""
|
||||
if not self.config:
|
||||
tiram_obj = self.converted.save(self.rougailconfig["tiramisu_cache"])
|
||||
|
@ -83,5 +83,9 @@ class Rougail:
|
|||
self.config.property.read_write()
|
||||
return self.config
|
||||
|
||||
def get_config(self):
|
||||
warn("get_config is deprecated, use run instead", DeprecationWarning, stacklevel=2)
|
||||
return self.run()
|
||||
|
||||
|
||||
__ALL__ = ("Rougail", "RougailConfig", "RougailUpgrade")
|
||||
|
|
|
@ -131,9 +131,33 @@ class _RougailConfig:
|
|||
def get_leadership(self,
|
||||
option
|
||||
) -> dict:
|
||||
leader, *followers = option.value.get().values()
|
||||
leader = None
|
||||
followers = []
|
||||
for opt, value in option.value.get().items():
|
||||
if opt.issymlinkoption():
|
||||
continue
|
||||
if leader is None:
|
||||
leader = value
|
||||
else:
|
||||
followers.append(value)
|
||||
return dict(zip(leader, followers))
|
||||
|
||||
def parse(self, config) -> str:
|
||||
for option in config:
|
||||
if option.isoptiondescription():
|
||||
yield from self.parse(option)
|
||||
elif not option.issymlinkoption():
|
||||
yield f'{option.path()}: {option.value.get()}'
|
||||
|
||||
def __repr__(self):
|
||||
self.config.property.read_write()
|
||||
try:
|
||||
values = "\n".join(self.parse(self.config))
|
||||
except Exception as err:
|
||||
values = str(err)
|
||||
self.config.property.read_only()
|
||||
return values
|
||||
|
||||
|
||||
class FakeRougailConvert(RougailConvert):
|
||||
def __init__(self,
|
||||
|
@ -199,7 +223,7 @@ extra_dictionaries:
|
|||
{% endif %}
|
||||
names:
|
||||
description: 'Extra namespace name'
|
||||
alternative_name: e
|
||||
alternative_name: x
|
||||
multi: true
|
||||
mandatory: false
|
||||
directories:
|
||||
|
|
Loading…
Reference in a new issue