diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-25 13:52:40 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-11-25 13:52:40 -0700 |
commit | 29d680b211021fe755522f4453853344233bc78e (patch) | |
tree | e667b1fc51982955bd562747b82d53fcd139b07b /ipalib/ipa_types.py | |
parent | 7350ccbffefdf81992b3ccd8aac814f3bb954be8 (diff) | |
download | freeipa-29d680b211021fe755522f4453853344233bc78e.tar.gz freeipa-29d680b211021fe755522f4453853344233bc78e.tar.xz freeipa-29d680b211021fe755522f4453853344233bc78e.zip |
Continued work on xmlrpc.dispatch() unit tests; fixed bug in Command.args_to_kw()
Diffstat (limited to 'ipalib/ipa_types.py')
-rw-r--r-- | ipalib/ipa_types.py | 7 |
1 files changed, 7 insertions, 0 deletions
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' |