diff options
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r-- | ipalib/frontend.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index da25b4c1a..47c72d1ab 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -557,6 +557,26 @@ class Command(HasParam): if name in params: yield(name, params[name]) + def split_csv(self, **kw): + """ + Return a dictionary of values where values are decoded from CSV. + + For example: + + >>> class my_command(Command): + ... takes_options = ( + ... Param('flags', multivalue=True, csv=True), + ... ) + ... + >>> c = my_command() + >>> c.finalize() + >>> c.split_csv(flags=u'public,replicated') + {'flags': (u'public', u'replicated')} + """ + return dict( + (k, self.params[k].split_csv(v)) for (k, v) in kw.iteritems() + ) + def normalize(self, **kw): """ Return a dictionary of normalized values. |