summaryrefslogtreecommitdiffstats
path: root/ipalib/parameters.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r--ipalib/parameters.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 128c8a46..78eacde2 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -1384,6 +1384,24 @@ class StrEnum(Enum):
type = unicode
+ def _convert_scalar(self, value, index=None):
+ """
+ Convert a single scalar value.
+ """
+ if type(value) is self.type:
+ return value
+ if type(value) is str:
+ try:
+ return value.decode('utf-8')
+ except UnicodeDecodeError:
+ raise ConversionError(
+ name=self.name, index=index,
+ error=ugettext(self.scalar_error)
+ )
+ raise ConversionError(name=self.name, index=index,
+ error=ugettext(self.type_error),
+ )
+
class List(Param):
"""