summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/base.py2
-rw-r--r--ipalib/config.py4
-rw-r--r--ipalib/constants.py2
-rw-r--r--ipalib/parameters.py4
4 files changed, 4 insertions, 8 deletions
diff --git a/ipalib/base.py b/ipalib/base.py
index 38b1e8f32..bc2c6b45a 100644
--- a/ipalib/base.py
+++ b/ipalib/base.py
@@ -216,7 +216,7 @@ def check_name(name):
>>> check_name('MyName')
Traceback (most recent call last):
...
- ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$'; got 'MyName'
+ ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$|^[a-z]$'; got 'MyName'
Also, this function will raise a ``TypeError`` if ``name`` is not an
``str`` instance. For example:
diff --git a/ipalib/config.py b/ipalib/config.py
index 5eef03b08..5311f9904 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -74,11 +74,11 @@ class Env(object):
>>> env.BadName = 'Wont work as an attribute'
Traceback (most recent call last):
...
- ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$'; got 'BadName'
+ ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$|^[a-z]$'; got 'BadName'
>>> env['BadName'] = 'Also wont work as a dictionary item'
Traceback (most recent call last):
...
- ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$'; got 'BadName'
+ ValueError: name must match '^[a-z][_a-z0-9]*[a-z0-9]$|^[a-z]$'; got 'BadName'
The variable values can be ``str``, ``int``, or ``float`` instances, or the
``True``, ``False``, or ``None`` constants. When the value provided is an
diff --git a/ipalib/constants.py b/ipalib/constants.py
index 0ace2a28c..79ddbca8f 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -26,7 +26,7 @@ All constants centralised in one file.
NULLS = (None, '', u'', tuple(), [])
# regular expression NameSpace member names must match:
-NAME_REGEX = r'^[a-z][_a-z0-9]*[a-z0-9]$'
+NAME_REGEX = r'^[a-z][_a-z0-9]*[a-z0-9]$|^[a-z]$'
# Format for ValueError raised when name does not match above regex:
NAME_ERROR = 'name must match %r; got %r'
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index b6133f1b1..e0b0ed2c5 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -192,10 +192,6 @@ def parse_param_spec(spec):
raise TypeError(
TYPE_ERROR % ('spec', str, spec, type(spec))
)
- if len(spec) < 2:
- raise ValueError(
- 'spec must be at least 2 characters; got %r' % spec
- )
_map = {
'?': dict(required=False, multivalue=False),
'*': dict(required=False, multivalue=True),