Skip to content

Commit

Permalink
Move custom loader discussion to better place
Browse files Browse the repository at this point in the history
For #92. We already had a section to talk about YAML loading, so I made
a subsection there.
  • Loading branch information
sampsyo committed May 28, 2020
1 parent 130d794 commit 5f1c6ae
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ the key doesn’t exist in any configuration file, Confuse will raise a
of ``confuse.ConfigError``) lets you painlessly validate the user’s
configuration as you go.

Confuse uses a custom loader based on pyyaml's SafeLoader with extra
contructors for yaml tags.
You can replace this Loader by a one of your own with an extra loader=
parameter::

config = confuse.Configuration("name", loader=yaml.Loaded)

You can even add yo your custom loader the confuse's loader feature
by calling add_constructors::

loader = yaml.Loader
confuse.Loader.add_constructors(loader)
config = confuse.Configuration("name", loader=loader)

View Theory
-----------
Expand Down Expand Up @@ -320,6 +307,23 @@ To produce a YAML string reflecting a configuration, just call
but it does play some tricks to preserve comments and spacing in the original
file.

Custom YAML Loaders
'''''''''''''''''''

Confuse uses a custom loader based on pyyaml's SafeLoader with extra
contructors for yaml tags.
You can replace this Loader by a one of your own with an extra loader=
parameter::

config = confuse.Configuration("name", loader=yaml.Loaded)

You can even add yo your custom loader the confuse's loader feature
by calling add_constructors::

loader = yaml.Loader
confuse.Loader.add_constructors(loader)
config = confuse.Configuration("name", loader=loader)


Configuring Large Programs
--------------------------
Expand Down

0 comments on commit 5f1c6ae

Please sign in to comment.