Chris McDonough
2010-11-10 fe417289979c168f261f1a887588d5cbf3c3a0fa
- New API method: ``pyramid.settings.asbool``.
3 files modified
8 ■■■■■ changed files
CHANGES.txt 2 ●●●●● patch | view | raw | blame | history
docs/api/settings.rst 3 ●●●●● patch | view | raw | blame | history
pyramid/settings.py 3 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -11,6 +11,8 @@
- Added class vars ``matchdict`` and ``matched_route`` to
  ``pyramid.request.Request``.  Each is set to ``None``.
- New API method: ``pyramid.settings.asbool``.
Bug Fixes
---------
docs/api/settings.rst
@@ -7,3 +7,6 @@
  .. autofunction:: get_settings
  .. autofunction:: asbool
pyramid/settings.py
@@ -80,6 +80,9 @@
    return reg.queryUtility(ISettings)
def asbool(s):
    """ Return the boolean value ``True`` if the case-lowered value of string
    input ``s`` is any of ``t``, ``true``, ``y``, ``on``, or ``1``, otherwise
    return the boolean value ``False``."""
    s = str(s).strip()
    return s.lower() in ('t', 'true', 'y', 'yes', 'on', '1')