Skip to content

Commit

Permalink
Use a better variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
kpinc committed Sep 7, 2024
1 parent 4ed71c9 commit a5573ab
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/pyramid/scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ def parse_vars(args):
return result


def get_config_loader(config_uri, out=None):
"""
Find a ``plaster.ILoader`` object supporting the "wsgi" protocol.
def get_config_loader(config_uri, report_failure=None):
"""Find a ``plaster.ILoader`` object supporting the "wsgi" protocol.
``out``, if passed, must be a function of one argument, a string.
The function is called with an error message when the ``config_uri``
cannot be used to obtain settings. After ``out`` is called the
program exits with a ``1`` (failure) status code.
``report_failure``, if passed, must be a function of one argument,
a string. The function is called with an error message when the
``config_uri`` cannot be used to obtain settings. After
``report_failure`` is called the program exits with a ``1``
(failure) status code.
When ``out`` is not passed, or is None, the caller is expected
When ``report_failure`` is not passed, or is None, the caller is expected
to handle PlasterError exceptions raised by :term:`plaster`.
"""
try:
return plaster.get_loader(config_uri, protocols=['wsgi'])
except plaster.exceptions.PlasterError as e:
if not out:
if not report_failure:
raise e
out(f'The settings given are not available: {e}')
report_failure(f'The settings given are not available: {e}')
sys.exit(1)

0 comments on commit a5573ab

Please sign in to comment.