Compare commits

..

No commits in common. "f4f5fb79e4dd09c88aaeafc3a1a818f45f019cf1" and "897d4dd21611c1b33931ee63c68fa479dad3f6bc" have entirely different histories.

42 changed files with 101 additions and 190 deletions

View file

@ -864,7 +864,7 @@ def _test_value_normal(name, cfg, option, unrestraint, without_index):
assert option.value.valid() is True
# list
if 'choice' in name:
assert option.value.list() == ['val1', 'val2']
assert option.value.list() == ('val1', 'val2')
else:
with pytest.raises(ConfigError):
option.value.list()

View file

@ -72,7 +72,6 @@ def test_choiceoption_function(config_type):
assert cfg.option('choice').owner.isdefault()
#
assert value_list(cfg.option('choice').value.list()) == ('val1', 'val2')
assert isinstance(cfg.option('choice').value.list(uncalculated=True), Calculation)
# assert not list_sessions()

View file

@ -9,14 +9,10 @@ do_autopath()
from .config import config_type, get_config, value_list, global_owner
import pytest
from tiramisu import Config, Calculation, Params, ParamSelfInformation, calc_value
from tiramisu import Config
from tiramisu.i18n import _
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined, \
DomainnameOption, EmailOption, URLOption, RegexpOption, IPOption, \
PortOption, NetworkOption, NetmaskOption, BroadcastOption, UsernameOption, \
GroupnameOption, DateOption, FilenameOption, PasswordOption, MACOption, \
PermissionsOption
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined
from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError
@ -133,29 +129,6 @@ def test_not_valid_properties():
# assert not list_sessions()
def test_information_load():
ChoiceOption('a', '', ('a', 'b'), informations={'info': 'value'})
BoolOption('a', '', informations={'info': 'value'})
IntOption('a', '', informations={'info': 'value'})
FloatOption('a', '', informations={'info': 'value'})
StrOption('a', '', informations={'info': 'value'})
RegexpOption('a', '', informations={'info': 'value'})
IPOption('a', '', informations={'info': 'value'})
PortOption('a', '', informations={'info': 'value'})
NetworkOption('a', '', informations={'info': 'value'})
NetmaskOption('a', '', informations={'info': 'value'})
BroadcastOption('a', '', informations={'info': 'value'})
DomainnameOption('a', '', informations={'info': 'value'})
EmailOption('a', '', informations={'info': 'value'})
URLOption('a', '', informations={'info': 'value'})
UsernameOption('a', '', informations={'info': 'value'})
GroupnameOption('a', '', informations={'info': 'value'})
DateOption('a', '', informations={'info': 'value'})
FilenameOption('a', '', informations={'info': 'value'})
PasswordOption('a', '', informations={'info': 'value'})
MACOption('a', '', informations={'info': 'value'})
PermissionsOption('a', '', informations={'info': 'value'})
def test_information_config():
od1 = make_description()
cfg = Config(od1)
@ -244,17 +217,6 @@ def test_information_option_2():
# assert not list_sessions()
def test_information_option_symlink():
i1 = IntOption('test1', '', Calculation(calc_value, Params(ParamSelfInformation('info'))), informations={'info': 'value'})
i2 = SymLinkOption('test2', i1)
od1 = OptionDescription('test', '', [i2, i1])
cfg = Config(od1)
# it's tuples
assert set(cfg.option('test1').information.list()) == {'info', 'doc'}
assert set(cfg.option('test2').information.list()) == {'info', 'doc'}
# assert not list_sessions()
def test_information_optiondescription():
od1 = make_description()
cfg = Config(od1)

View file

@ -77,22 +77,6 @@ def test_build_dyndescription():
assert parse_od_get(cfg.value.get()) == {'dodval1.st': None, 'dodval2.st': None}
assert cfg.option('dodval1').isdynamic()
assert cfg.option('dodval1.st').isdynamic()
assert cfg.option('dodval1').isdynamic(only_self=True)
assert not cfg.option('dodval1.st').isdynamic(only_self=True)
# assert not list_sessions()
def test_dyndescription_suffixes():
st1 = StrOption('st', '')
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list))
od1 = OptionDescription('od', '', [dod])
cfg = Config(od1)
assert parse_od_get(cfg.value.get()) == {'dodval1.st': None, 'dodval2.st': None}
assert cfg.option('dodval1').suffixes() == ['val1']
assert cfg.option('dodval1.st').suffixes() == ['val1']
assert cfg.option('dodval1').suffixes(only_self=True) == ['val1', 'val2']
with pytest.raises(ConfigError):
cfg.option('dodval1.st').suffixes(only_self=True)
# assert not list_sessions()
@ -180,10 +164,8 @@ def test_getdoc_dyndescription():
cfg = Config(od2)
assert cfg.option('od.dodval1.st').name() == 'st'
assert cfg.option('od.dodval2.st').name() == 'st'
assert cfg.option('od.dodval1.st').name(uncalculated=True) == cfg.option('od.dodval2.st').name(uncalculated=True) == 'st'
assert cfg.option('od.dodval1').name() == 'dodval1'
assert cfg.option('od.dodval2').name() == 'dodval2'
assert cfg.option('od.dodval1').name(uncalculated=True) == cfg.option('od.dodval2').name(uncalculated=True) == 'dod'
assert cfg.option('od.dodval1.st').doc() == 'doc1'
assert cfg.option('od.dodval2.st').doc() == 'doc1'
assert cfg.option('od.dodval1').doc() == 'doc2'
@ -191,20 +173,6 @@ def test_getdoc_dyndescription():
# assert not list_sessions()
def test_dyndescription_path():
st1 = StrOption('st', 'doc1')
dod = DynOptionDescription('dod', 'doc2', [st1], suffixes=Calculation(return_list))
od1 = OptionDescription('od', '', [dod])
od2 = OptionDescription('od', '', [od1])
cfg = Config(od2)
assert cfg.option('od.dodval1.st').path() == 'od.dodval1.st'
assert cfg.option('od.dodval2.st').path() == 'od.dodval2.st'
assert cfg.option('od.dodval1.st').path(uncalculated=True) == cfg.option('od.dodval2.st').path(uncalculated=True) == 'od.dod.st'
assert cfg.option('od.dodval1').path() == 'od.dodval1'
assert cfg.option('od.dodval2').path() == 'od.dodval2'
assert cfg.option('od.dodval1').path(uncalculated=True) == cfg.option('od.dodval2').path(uncalculated=True) == 'od.dod'
def test_mod_dyndescription():
st = StrOption('st', '')
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))

View file

@ -289,7 +289,6 @@ def test_callback(config_type):
cfg = Config(od1)
cfg.property.read_write()
cfg = get_config(cfg, config_type)
assert isinstance(cfg.option('val1').value.get(uncalculated=True), Calculation)
assert cfg.option('val1').value.get() == 'val'
cfg.option('val1').value.set('new-val')
assert cfg.option('val1').value.get() == 'new-val'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -199,11 +199,9 @@ class _TiramisuOptionWalk:
def _list(self,
subconfig: SubConfig,
validate_properties: bool,
*,
uncalculated: bool=False,
):
options = []
for sub_subconfig in subconfig.get_children(validate_properties, uncalculated=uncalculated):
for sub_subconfig in subconfig.get_children(validate_properties=validate_properties):
options.append(TiramisuOption(sub_subconfig.path,
sub_subconfig.index,
self._config_bag,
@ -245,23 +243,15 @@ class _TiramisuOptionOptionDescription:
)
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
def name(self,
*,
uncalculated: bool=False,
) -> str:
def name(self) -> str:
"""Get option name"""
if uncalculated:
return self._subconfig.option.impl_getname()
#FIXME impl_getname ?
return self._subconfig.true_path.rsplit('.', 1)[-1]
@option_type(['optiondescription', 'option', 'with_or_without_index', 'symlink'])
def path(self,
*,
uncalculated: bool=False,
) -> str:
"""Get option path"""
if uncalculated:
return self._subconfig.option.impl_getpath()
return self._subconfig.true_path
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
@ -291,14 +281,9 @@ class _TiramisuOptionOptionDescription:
return option.get_type()
@option_type(['option', 'optiondescription', 'symlink', 'with_or_without_index'])
def isdynamic(self,
*,
only_self: bool=False):
def isdynamic(self):
"""Test if option is a dynamic optiondescription"""
if not only_self:
return self._subconfig.is_dynamic
return self._subconfig.option.impl_is_optiondescription() and \
self._subconfig.option.impl_is_dynoptiondescription()
return self._subconfig.is_dynamic
@option_type(['option', 'leadership'])
def leader(self):
@ -319,16 +304,9 @@ class _TiramisuOptionOptionDescription:
)
@option_type(['dynamic', 'with_or_without_index'])
def suffixes(self,
only_self: bool=False,
):
def suffixes(self):
"""Get suffixes for dynamic option"""
if not only_self:
return self._subconfig.suffixes
if not self._subconfig.option.impl_is_optiondescription() or \
not self._subconfig.option.impl_is_dynoptiondescription():
raise ConfigError(_(f'the option {self._subconfig.path} is not a dynamic option, cannot get suffixes with only_self parameter to True'))
return self._subconfig.option.get_suffixes(self._subconfig.parent)
return self._subconfig.suffixes
class _TiramisuOptionOption(_TiramisuOptionOptionDescription):
@ -469,7 +447,6 @@ class TiramisuOptionProperty(CommonTiramisuOption):
@option_type(['option', 'optiondescription', 'with_index', 'symlink'])
def get(self,
*,
only_raises: bool=False,
apply_requires: bool=True,
uncalculated: bool=False,
@ -614,6 +591,7 @@ class _TiramisuODGet():
"""exports the whole config into a `dict`
:returns: dict of Option's name (or path) and values
"""
#for self._subconfig, value in self._config_bag.context.walk(root_self._subconfig):
def parse_od_get(values):
ret_ = {}
for subconfig, value in values.items():
@ -626,6 +604,19 @@ class _TiramisuODGet():
value = parse_od_get(value)
ret_[option] = value
return ret_
# else:
# leader_ret = []
# leader = data['leader']
# for idx, value in enumerate(self.get_value(leader,
# need_help=False,
# )):
# leader_dict = {leader: value}
# for follower in data.get(idx, []):
# leader_dict[follower] = self.get_value(follower,
# need_help=False,
# )
# leader_ret.append(leader_dict)
# ret[leader] = leader_ret
return parse_od_get(self._config_bag.context.walk(root_subconfig))
@ -634,18 +625,11 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
_validate_properties = True
@option_type(['option', 'symlink', 'with_index', 'optiondescription'])
def get(self,
*,
uncalculated: bool=False,
):
def get(self):
"""Get value for an option or option and sub option with values with optiondescription"""
if self._subconfig.option.impl_is_optiondescription():
if uncalculated:
raise ConfigError('uncalculated is not allowed for optiondescription')
return self._od_get(self._subconfig)
if uncalculated:
return self._subconfig.option.impl_getdefault()
return self._get(uncalculated)
return self._get()
def _get(self,
need_help: bool=True,
@ -704,14 +688,9 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
return True
@option_type(['choice', 'with_index'])
def list(self,
*,
uncalculated: bool=False,
):
def list(self):
"""All values available for a ChoiceOption"""
return self._subconfig.option.impl_get_values(self._subconfig,
uncalculated,
)
return self._subconfig.option.impl_get_values(self._subconfig)
@option_type('leader')
def pop(self,
@ -832,14 +811,11 @@ class TiramisuOption(CommonTiramisu,
@option_type('optiondescription')
def list(self,
*,
validate_properties: bool=True,
uncalculated: bool=False,
):
"""List options inside an option description (by default list only option)"""
return self._list(self._subconfig,
validate_properties,
uncalculated=uncalculated,
)
def _load_dict(self,
@ -1086,7 +1062,6 @@ class TiramisuContextProperty(TiramisuConfig, PropertyPermissive):
self._set(frozenset(props))
def get(self,
*,
only_raises: bool=False,
apply_requires: bool=True,
uncalculated: bool=False,

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"cache used by storage"
# Copyright (C) 2013-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2013-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -296,14 +296,12 @@ class SubConfig:
def get_children(self,
validate_properties,
*,
uncalculated: bool=False,
):
if self.option.impl_is_leadership():
yield from self.get_leadership_children(validate_properties)
else:
for child in self.option.get_children():
if child.impl_is_dynoptiondescription() and not uncalculated:
if child.impl_is_dynoptiondescription():
yield from self.dyn_to_subconfig(child,
validate_properties,
)

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,4 +1,4 @@
# Copyright (C) 2018-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2018-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: UTF-8 -*-
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"logger for tiramisu"
# Copyright (C) 2019-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2019-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -58,15 +58,12 @@ class ChoiceOption(Option):
def impl_get_values(self,
subconfig: "SubConfig",
uncalculated: bool=False,
):
"""get values allowed by option
"""
choices = self._choice_values
if isinstance(choices, tuple):
choices = list(choices)
if uncalculated:
return choices
values = get_calculated_value(subconfig,
choices,
)[0]

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -45,13 +45,17 @@ class DomainnameOption(StrOption):
def __init__(self,
name: str,
doc: str,
*args,
default: Any=undefined,
default_multi: Any=None,
multi: bool=False,
validators: Optional[List[Calculation]]=None,
properties: Optional[List[str]]=None,
warnings_only: bool=False,
allow_ip: bool=False,
allow_cidr_network: bool=False,
type: str='domainname',
allow_without_dot: bool=False,
allow_startswith_dot: bool=False,
**kwargs,
) -> None:
# pylint: disable=too-many-branches,too-many-locals,too-many-arguments
if type not in ['netbios', 'hostname', 'domainname']:
@ -90,23 +94,24 @@ class DomainnameOption(StrOption):
extra['_has_upper'] = re.compile('[A-Z]')
if allow_ip:
extra['_ip'] = IPOption(name,
doc,
)
doc)
extra['_allow_ip'] = allow_ip
if allow_cidr_network:
extra['_network'] = NetworkOption(name,
doc,
cidr=True,
)
cidr=True)
extra['_allow_cidr_network'] = allow_cidr_network
extra['_allow_startswith_dot'] = allow_startswith_dot
super().__init__(name,
doc,
*args,
extra=extra,
**kwargs,
)
default=default,
default_multi=default_multi,
multi=multi,
validators=validators,
properties=properties,
warnings_only=warnings_only,
extra=extra)
def _get_len(self, type_):
if type_ == 'netbios':

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"Leadership support"
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2020-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2020-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"option types and option description"
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -86,7 +86,7 @@ class CacheOptionDescription(BaseOption):
force_store_values,
dependencies_information,
)
elif not option.impl_is_symlinkoption():
else:
informations = option.get_dependencies_information()
if informations:
for param in informations.pop(None):
@ -94,9 +94,10 @@ class CacheOptionDescription(BaseOption):
for information, options in option.get_dependencies_information().items():
if None in options:
dependencies_information.setdefault(information, []).append(option)
properties = option.impl_getproperties()
if 'force_store_value' in properties:
force_store_values.append(option)
if not option.impl_is_symlinkoption():
properties = option.impl_getproperties()
if 'force_store_value' in properties:
force_store_values.append(option)
if option.impl_is_readonly():
raise ConflictError(_('duplicate option: {0}').format(option))
if not self.impl_is_readonly() and display_name:

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2023-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
@ -41,7 +41,13 @@ class URLOption(StrOption):
def __init__(self,
name: str,
doc: str,
*args,
default: Any=undefined,
default_multi: Any=None,
multi: bool=False,
validators: Optional[List[Calculation]]=None,
properties: Optional[List[str]]=None,
warnings_only: bool=False,
extra: Optional[Dict]=None,
allow_ip: bool=False,
type: str='domainname',
allow_without_dot=False,
@ -49,9 +55,7 @@ class URLOption(StrOption):
allow_zero: bool=False,
allow_wellknown: bool=True,
allow_registred: bool=True,
allow_private: bool=False,
**kwargs,
) -> None:
allow_private: bool=False) -> None:
# pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
extra = {'_domainname': DomainnameOption(name,
doc,
@ -67,10 +71,13 @@ class URLOption(StrOption):
allow_private=allow_private)}
super().__init__(name,
doc,
extra=extra,
*args,
**kwargs,
)
default=default,
default_multi=default_multi,
multi=multi,
validators=validators,
properties=properties,
warnings_only=warnings_only,
extra=extra)
def _get_domain_port_files(self,
value: str) -> (str, str):

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"sets the options of the configuration objects Config object itself"
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"takes care of the option's values and multi values"
# Copyright (C) 2013-2024 Team tiramisu (see AUTHORS for all contributors)
# Copyright (C) 2013-2023 Team tiramisu (see AUTHORS for all contributors)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the