From 2490d009353e5c860b9c6858175d81ea4d9ae002 Mon Sep 17 00:00:00 2001 From: gwen Date: Fri, 27 Sep 2013 11:28:23 +0200 Subject: [PATCH] refactor name only_private --- test/test_config_ip.py | 2 +- tiramisu/option.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_config_ip.py b/test/test_config_ip.py index 2bdba53..b7d3010 100644 --- a/test/test_config_ip.py +++ b/test/test_config_ip.py @@ -7,7 +7,7 @@ from tiramisu.option import IPOption, NetworkOption, NetmaskOption, \ def test_ip(): a = IPOption('a', '') - b = IPOption('b', '', only_private=True) + b = IPOption('b', '', private_only=True) od = OptionDescription('od', '', [a, b]) c = Config(od) c.a = '192.168.1.1' diff --git a/tiramisu/option.py b/tiramisu/option.py index df4839a..f9a3541 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -756,15 +756,15 @@ class SymLinkOption(BaseOption): class IPOption(Option): "represents the choice of an ip" - __slots__ = ('_only_private', '_allow_reserved') + __slots__ = ('_private_only', '_allow_reserved') _opt_type = 'ip' def __init__(self, name, doc, default=None, default_multi=None, requires=None, multi=False, callback=None, callback_params=None, validator=None, validator_params=None, - properties=None, only_private=False, allow_reserved=False, + properties=None, private_only=False, allow_reserved=False, warnings_only=False): - self._only_private = only_private + self._private_only = private_only self._allow_reserved = allow_reserved super(IPOption, self).__init__(name, doc, default=default, default_multi=default_multi, @@ -787,7 +787,7 @@ class IPOption(Option): ip = IP('{0}/32'.format(value)) if not self._allow_reserved and ip.iptype() == 'RESERVED': raise ValueError(_("IP mustn't not be in reserved class")) - if self._only_private and not ip.iptype() == 'PRIVATE': + if self._private_only and not ip.iptype() == 'PRIVATE': raise ValueError(_("IP must be in private class"))