Minor changes, additions and clarifications.

This commit is contained in:
Vinay Sajip 2009-11-24 06:52:39 +00:00
parent b6219b9be0
commit 7c738150a2
1 changed files with 18 additions and 14 deletions

View File

@ -305,9 +305,9 @@ specify::
custom: custom:
(): my.package.MyHandler (): my.package.MyHandler
alternate: int://handlers.file alternate: cfg://handlers.file
The literal string ``'int://handlers.file'`` will be resolved in an The literal string ``'cfg://handlers.file'`` will be resolved in an
analogous way to the strings with the ``ext://`` prefix, but looking analogous way to the strings with the ``ext://`` prefix, but looking
in the configuration itself rather than the import namespace. The in the configuration itself rather than the import namespace. The
mechanism will allow access by dot or by index, in a similar way to mechanism will allow access by dot or by index, in a similar way to
@ -323,29 +323,29 @@ that provided by ``str.format``. Thus, given the following snippet::
- dev_team@domain.tld - dev_team@domain.tld
subject: Houston, we have a problem. subject: Houston, we have a problem.
in the configuration, the string ``'int://handlers'`` would resolve to in the configuration, the string ``'cfg://handlers'`` would resolve to
the dict with key ``handlers``, the string ``'int://handlers.email`` the dict with key ``handlers``, the string ``'cfg://handlers.email``
would resolve to the dict with key ``email`` in the ``handlers`` dict, would resolve to the dict with key ``email`` in the ``handlers`` dict,
and so on. The string ``'int://handlers.email.toaddrs[1]`` would and so on. The string ``'cfg://handlers.email.toaddrs[1]`` would
resolve to ``'dev_team.domain.tld'`` and the string resolve to ``'dev_team.domain.tld'`` and the string
``'int://handlers.email.toaddrs[0]'`` would resolve to the value ``'cfg://handlers.email.toaddrs[0]'`` would resolve to the value
``'support_team@domain.tld'``. The ``subject`` value could be accessed ``'support_team@domain.tld'``. The ``subject`` value could be accessed
using either ``'int://handlers.email.subject'`` or, equivalently, using either ``'cfg://handlers.email.subject'`` or, equivalently,
``'int://handlers.email[subject]'``. The latter form only needs to be ``'cfg://handlers.email[subject]'``. The latter form only needs to be
used if the key contains spaces or non-alphanumeric characters. If an used if the key contains spaces or non-alphanumeric characters. If an
index value consists only of decimal digits, access will be attempted index value consists only of decimal digits, access will be attempted
using the corresponding integer value, falling back to the string using the corresponding integer value, falling back to the string
value if needed. value if needed.
Given a string ``int://handlers.myhandler.mykey.123``, this will Given a string ``cfg://handlers.myhandler.mykey.123``, this will
resolve to ``config_dict['handlers']['myhandler']['mykey']['123']``. resolve to ``config_dict['handlers']['myhandler']['mykey']['123']``.
If the string is specified as ``int://handlers.myhandler.mykey[123]``, If the string is specified as ``cfg://handlers.myhandler.mykey[123]``,
the system will attempt to retrieve the value from the system will attempt to retrieve the value from
``config_dict['handlers']['myhandler']['mykey'][123]``, ad fall back ``config_dict['handlers']['myhandler']['mykey'][123]``, and fall back
to ``config_dict['handlers']['myhandler']['mykey']['123']`` if that to ``config_dict['handlers']['myhandler']['mykey']['123']`` if that
fails. fails.
Note: the ``ext`` and ``int`` prefixes are provisional. If better Note: the ``ext`` and ``cfg`` prefixes are provisional. If better
alternatives are suggested during the PEP review process, they will be alternatives are suggested during the PEP review process, they will be
used. used.
@ -484,7 +484,11 @@ determine how to instantiate.
If the specified value is ``True``, the configuration is processed If the specified value is ``True``, the configuration is processed
as described in the section on `Incremental Configuration`_, below. as described in the section on `Incremental Configuration`_, below.
* `disable_existing_loggers` - whether any existing loggers are to be
disabled. This setting mirrors the parameter of the same name in
``fileConfig()``. If absent, this parameter defaults to ``True``.
This value is ignored if `incremental` is ``True``.
A Working Example A Working Example
----------------- -----------------
@ -567,7 +571,7 @@ settings in the ``handlers`` entries, and the ``level`` and
It's certainly possible to provide incremental configuration by other It's certainly possible to provide incremental configuration by other
means, for example making ``dictConfig()`` take an ``incremental`` means, for example making ``dictConfig()`` take an ``incremental``
keyword argument which defaults to ``False``. The reason for keyword argument which defaults to ``False``. The reason for
suggesting that a flag in the configuration dict be used is that it suggesting that a value in the configuration dict be used is that it
allows for configurations to be sent over the wire as pickled dicts allows for configurations to be sent over the wire as pickled dicts
to a socket listener. Thus, the logging verbosity of a long-running to a socket listener. Thus, the logging verbosity of a long-running
application can be altered over time with no need to stop and application can be altered over time with no need to stop and