summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-21 22:18:33 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-21 22:18:33 +0000
commit952b45f13859a1b10a790f3448bed088a924b280 (patch)
treea86a4266de980ba8bc68f19de9c97c78dae6b7ed
parent14e932a8cdac2c1512880b69dc1932853d72261d (diff)
downloadfreeipa.git-952b45f13859a1b10a790f3448bed088a924b280.tar.gz
freeipa.git-952b45f13859a1b10a790f3448bed088a924b280.tar.xz
freeipa.git-952b45f13859a1b10a790f3448bed088a924b280.zip
311: Renamed generate_option() to create_param()
-rw-r--r--ipalib/public.py13
-rw-r--r--ipalib/tests/test_public.py6
2 files changed, 12 insertions, 7 deletions
diff --git a/ipalib/public.py b/ipalib/public.py
index e70103ea..97843ef3 100644
--- a/ipalib/public.py
+++ b/ipalib/public.py
@@ -198,9 +198,14 @@ class Param(plugable.ReadOnly):
)
-def generate_option(name):
+def create_param(name):
"""
- Returns an `Param` instance by parsing ``name``.
+ Create a `Param` instance from a param name.
+
+ If ``name`` is a `Param` instance, it is returned unchanged.
+
+ If ``name`` is a <type str>, then ``name`` is parsed and a correpsonding
+ `Param` instance is created and returned.
"""
if type(name) is Param:
return name
@@ -262,7 +267,7 @@ class Command(plugable.Plugin):
multivalue = False
for arg in self.get_args():
if type(arg) is str:
- arg = generate_option(arg)
+ arg = create_param(arg)
elif not isinstance(arg, Param):
raise TypeError(
'arg: need %r or %r; got %r' % (str, Param, arg)
@@ -284,7 +289,7 @@ class Command(plugable.Plugin):
def __check_options(self):
for option in self.get_options():
if type(option) is str:
- option = generate_option(option)
+ option = create_param(option)
elif not isinstance(option, Param):
raise TypeError(
'option: need %r or %r; got %r' % (str, Param, option)
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index bd6f3a95..01eadabd 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -309,11 +309,11 @@ class test_Option(ClassChecker):
assert o.get_values() == values
-def test_generate_option():
+def test_create_param():
"""
- Tests the `public.generate_option` function.
+ Test the `public.create_param` function.
"""
- f = public.generate_option
+ f = public.create_param
for name in ['arg', 'arg?', 'arg*', 'arg+']:
o = f(name)
assert type(o) is public.Param