mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Remove csv_separator and csv_skipspace Param arguments
These were never set to anything but the defaults. Part of work for https://fedorahosted.org/freeipa/ticket/3352
This commit is contained in:
committed by
Martin Kosek
parent
da42daac29
commit
b4915bd2fd
@@ -356,10 +356,6 @@ class Param(ReadOnly):
|
|||||||
- sortorder: used to sort a list of parameters for Command. See
|
- sortorder: used to sort a list of parameters for Command. See
|
||||||
`Command.finalize()` for further information
|
`Command.finalize()` for further information
|
||||||
- csv: this multivalue attribute is given in CSV format
|
- csv: this multivalue attribute is given in CSV format
|
||||||
- csv_separator: character that separates values in CSV (comma by
|
|
||||||
default)
|
|
||||||
- csv_skipspace: if true, leading whitespace will be ignored in
|
|
||||||
individual CSV values
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# This is a dummy type so that most of the functionality of Param can be
|
# This is a dummy type so that most of the functionality of Param can be
|
||||||
@@ -393,8 +389,6 @@ class Param(ReadOnly):
|
|||||||
('alwaysask', bool, False),
|
('alwaysask', bool, False),
|
||||||
('sortorder', int, 2), # see finalize()
|
('sortorder', int, 2), # see finalize()
|
||||||
('csv', bool, False),
|
('csv', bool, False),
|
||||||
('csv_separator', str, ','),
|
|
||||||
('csv_skipspace', bool, True),
|
|
||||||
('option_group', unicode, None),
|
('option_group', unicode, None),
|
||||||
|
|
||||||
# The 'default' kwarg gets appended in Param.__init__():
|
# The 'default' kwarg gets appended in Param.__init__():
|
||||||
@@ -690,9 +684,8 @@ class Param(ReadOnly):
|
|||||||
def __unicode_csv_reader(self, unicode_csv_data, dialect=csv.excel, **kwargs):
|
def __unicode_csv_reader(self, unicode_csv_data, dialect=csv.excel, **kwargs):
|
||||||
# csv.py doesn't do Unicode; encode temporarily as UTF-8:
|
# csv.py doesn't do Unicode; encode temporarily as UTF-8:
|
||||||
csv_reader = csv.reader(self.__utf_8_encoder(unicode_csv_data),
|
csv_reader = csv.reader(self.__utf_8_encoder(unicode_csv_data),
|
||||||
dialect=dialect,
|
dialect=dialect, delimiter=',', quotechar='"',
|
||||||
delimiter=self.csv_separator, quotechar='"',
|
skipinitialspace=True,
|
||||||
skipinitialspace=self.csv_skipspace,
|
|
||||||
**kwargs)
|
**kwargs)
|
||||||
try:
|
try:
|
||||||
for row in csv_reader:
|
for row in csv_reader:
|
||||||
@@ -967,8 +960,7 @@ class Param(ReadOnly):
|
|||||||
|
|
||||||
json_exclude_attrs = (
|
json_exclude_attrs = (
|
||||||
'alwaysask', 'autofill', 'cli_name', 'cli_short_name', 'csv',
|
'alwaysask', 'autofill', 'cli_name', 'cli_short_name', 'csv',
|
||||||
'csv_separator', 'csv_skipspace', 'sortorder', 'falsehoods', 'truths',
|
'sortorder', 'falsehoods', 'truths', 'version',
|
||||||
'version',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __json__(self):
|
def __json__(self):
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class IPATypeChecker(TypeChecker):
|
|||||||
'default', 'doc', 'required', 'multivalue', 'primary_key',
|
'default', 'doc', 'required', 'multivalue', 'primary_key',
|
||||||
'normalizer', 'default_from', 'autofill', 'query', 'attribute',
|
'normalizer', 'default_from', 'autofill', 'query', 'attribute',
|
||||||
'include', 'exclude', 'flags', 'hint', 'alwaysask', 'sortorder',
|
'include', 'exclude', 'flags', 'hint', 'alwaysask', 'sortorder',
|
||||||
'csv', 'csv_separator', 'csv_skipspace', 'option_group'],
|
'csv', 'option_group'],
|
||||||
'ipalib.parameters.Bool': ['truths', 'falsehoods'],
|
'ipalib.parameters.Bool': ['truths', 'falsehoods'],
|
||||||
'ipalib.parameters.Data': ['minlength', 'maxlength', 'length',
|
'ipalib.parameters.Data': ['minlength', 'maxlength', 'length',
|
||||||
'pattern', 'pattern_errmsg'],
|
'pattern', 'pattern_errmsg'],
|
||||||
|
|||||||
@@ -203,8 +203,6 @@ class test_Param(ClassChecker):
|
|||||||
assert o.flags == frozenset()
|
assert o.flags == frozenset()
|
||||||
assert o.sortorder == 2
|
assert o.sortorder == 2
|
||||||
assert o.csv is False
|
assert o.csv is False
|
||||||
assert o.csv_separator == ','
|
|
||||||
assert o.csv_skipspace is True
|
|
||||||
|
|
||||||
# Test that doc defaults from label:
|
# Test that doc defaults from label:
|
||||||
o = self.cls('my_param', doc=_('Hello world'))
|
o = self.cls('my_param', doc=_('Hello world'))
|
||||||
@@ -635,35 +633,6 @@ class test_Param(ClassChecker):
|
|||||||
assert e.name == 'my_list'
|
assert e.name == 'my_list'
|
||||||
assert e.error == u'Improperly formatted CSV value (newline inside string)'
|
assert e.error == u'Improperly formatted CSV value (newline inside string)'
|
||||||
|
|
||||||
def test_split_csv_separator(self):
|
|
||||||
"""
|
|
||||||
Test the `ipalib.parameters.Param.split_csv` method with csv and a separator.
|
|
||||||
"""
|
|
||||||
o = self.cls('my_list+', csv=True, csv_separator='|')
|
|
||||||
|
|
||||||
n = o.split_csv('a')
|
|
||||||
assert type(n) is tuple
|
|
||||||
assert len(n) is 1
|
|
||||||
|
|
||||||
n = o.split_csv('a|b')
|
|
||||||
assert type(n) is tuple
|
|
||||||
assert len(n) is 2
|
|
||||||
|
|
||||||
def test_split_csv_skipspace(self):
|
|
||||||
"""
|
|
||||||
Test the `ipalib.parameters.Param.split_csv` method with csv without skipping spaces.
|
|
||||||
"""
|
|
||||||
o = self.cls('my_list+', csv=True, csv_skipspace=False)
|
|
||||||
|
|
||||||
n = o.split_csv('a')
|
|
||||||
assert type(n) is tuple
|
|
||||||
assert len(n) is 1
|
|
||||||
|
|
||||||
n = o.split_csv('a, "b,c", d')
|
|
||||||
assert type(n) is tuple
|
|
||||||
# the output w/o skipspace is ['a',' "b','c"',' d']
|
|
||||||
assert len(n) is 4
|
|
||||||
|
|
||||||
|
|
||||||
class test_Flag(ClassChecker):
|
class test_Flag(ClassChecker):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user