diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-02 01:14:37 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-02 01:14:37 -0700 |
commit | 7be459af0b52753ccde74e6833d664341935973d (patch) | |
tree | a0117f78f6239f09a68f4567e861f99a3cdf3026 /ipalib | |
parent | b4dc333ee2a010f3629002932d06a8b8a10df1d3 (diff) | |
download | freeipa-7be459af0b52753ccde74e6833d664341935973d.tar.gz freeipa-7be459af0b52753ccde74e6833d664341935973d.tar.xz freeipa-7be459af0b52753ccde74e6833d664341935973d.zip |
Added a bit to config.Env docstring about that variable names must pass check_name() function
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/config.py | 14 |
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 |