From 22493eef216a587bf076f81e558c476b6dd513bf Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 4 Aug 2009 00:21:26 -0600 Subject: Fix three broken unit tests --- ipalib/parameters.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'ipalib/parameters.py') diff --git a/ipalib/parameters.py b/ipalib/parameters.py index d9e33f8a..1b3b2b71 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -261,13 +261,6 @@ class Param(ReadOnly): self.name = check_name(name) self.nice = '%s(%r)' % (self.__class__.__name__, self.param_spec) - if 'cli_short_name' in kw: - if len(kw['cli_short_name']) != 1: - raise TypeError( - '%s: cli_short_name can only be a single character: %s' - % (self.nice, kw['cli_short_name']) - ) - # Add 'default' to self.kwargs and makes sure no unknown kw were given: assert type(self.type) is type if kw.get('multivalue', True): @@ -360,6 +353,13 @@ class Param(ReadOnly): '%s: rules must be callable; got %r' % (self.nice, rule) ) + # Check that cli_short_name is only 1 character long: + if not (self.cli_short_name is None or len(self.cli_short_name) == 1): + raise ValueError( + '%s: cli_short_name can only be a single character: %s' % ( + self.nice, self.cli_short_name) + ) + # And we're done. lock(self) @@ -1244,4 +1244,3 @@ def create_param(spec): TYPE_ERROR % ('spec', (str, Param), spec, type(spec)) ) return Str(spec) - -- cgit