summaryrefslogtreecommitdiffstats
path: root/ipalib/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/config.py')
-rw-r--r--ipalib/config.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipalib/config.py b/ipalib/config.py
index 6feae5735..04f1442fd 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -65,6 +65,20 @@ class Env(object):
>>> env.item # Also retrieve as an attribute
'I was set as a dictionary item.'
+ The variable names must be valid lower-case Python identifiers that neither
+ start nor end with an underscore. If your variable name doesn't meet these
+ criteria, a ``ValueError`` will be raised when you try to set the variable
+ (compliments of the `base.check_name()` function). For example:
+
+ >>> 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'
+ >>> 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'
+
The variable values can be ``str``, ``int``, or ``float`` instances, or the
``True``, ``False``, or ``None`` constants. When the value provided is an
``str`` instance, some limited automatic type conversion is performed, which