improve the documentation for option location information

Fix an error in the example code by setting loc to the Location enum
value instead of the LocationInfo tuple.

Add a cross-reference from the ConfigOpts get_location() method to the
more extensive reference documentation about option locations.

Change-Id: Ic9850afd78a7b42f4e807b04e78729a674942e15
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-06-13 13:37:16 -04:00
parent c8a8f4eba1
commit 1319cfb476
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ user-controlled separately.
.. code-block:: python
loc = CONF.get_location('normal_opt')
loc = CONF.get_location('normal_opt').location
if loc.is_user_controlled:
print('normal_opt was set by the user')
else:

View File

@ -3383,6 +3383,10 @@ class ConfigOpts(collections.Mapping):
:type group: str
:return: LocationInfo
.. seealso::
:doc:`/reference/locations`
.. versionadded:: 5.3.0
"""
value, loc = self._do_get(name, group, None)