summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/frontend.py8
-rw-r--r--ipalib/ipa_types.py7
2 files changed, 14 insertions, 1 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 6dcbea694..e4dd7637a 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -577,12 +577,18 @@ class Command(plugable.Plugin):
if len(values) > i:
if arg.multivalue:
multivalue = True
- yield (arg.name, values[i:])
+ if len(values) == i + 1 and type(values[i]) in (list, tuple):
+ yield (arg.name, values[i])
+ else:
+ yield (arg.name, values[i:])
else:
yield (arg.name, values[i])
else:
break
+ def args_options_2_params(self, args, options):
+ pass
+
def params_2_args_options(self, params):
"""
Split params into (args, kw).
diff --git a/ipalib/ipa_types.py b/ipalib/ipa_types.py
index 2da8e0be8..583cceed8 100644
--- a/ipalib/ipa_types.py
+++ b/ipalib/ipa_types.py
@@ -145,6 +145,13 @@ class Unicode(Type):
self.regex = re.compile(pattern)
super(Unicode, self).__init__(unicode)
+ def convert(self, value):
+ assert type(value) not in (list, tuple)
+ try:
+ return self.type(value)
+ except (TypeError, ValueError):
+ return None
+
def validate(self, value):
if type(value) is not self.type:
return 'Must be a string'