Skip to content

Commit

Permalink
Merge pull request #28 from doismellburning/feature/docstring-all-the…
Browse files Browse the repository at this point in the history
…-things

Docstring all the things
  • Loading branch information
doismellburning committed Feb 22, 2015
2 parents d3d49d2 + 4f60936 commit 315a33c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
19 changes: 19 additions & 0 deletions django12factor/__init__.py
@@ -1,3 +1,11 @@
"""
django12factor: Bringing 12factor configuration to Django.
* http://12factor.net/
* http://12factor.net/config
* https://github.com/doismellburning/django12factor
"""

import django_cache_url
import dj_database_url
import dj_email_url
Expand All @@ -15,6 +23,17 @@


def getenv_bool(setting_name):
"""
Get a boolean from an environment variable.
Why use this and not just `bool(os.getenv("X"))`? It would be quite
reasonable to see `DEBUG=true`, and infer that setting `DEBUG=false` would
Do The Right Thing; however `bool("false") == True`.
This function attempts to do basic "is the string falsey" detection so
`DEBUG=false` behaves as expected
"""

if setting_name not in os.environ:
return False

Expand Down
9 changes: 9 additions & 0 deletions tests/env.py
Expand Up @@ -2,6 +2,15 @@


class Env(object):
"""
Test helper providing temporary environments.
Usage:
with Env(DEBUG="true"):
d = django12factor.factorise()
"""

def __init__(self, **kwargs):
self.environ = kwargs

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -30,4 +30,4 @@ commands =

[testenv:pep257]
commands =
pep257 --ignore D100,D101,D102,D103,D200,D202,D203 django12factor tests
pep257 --ignore D200,D202,D203 django12factor

0 comments on commit 315a33c

Please sign in to comment.