defaults for env

This commit is contained in:
Kenneth Reitz 2012-05-30 01:23:28 -04:00
parent 9ab34db82a
commit 2a78118ec7
2 changed files with 8 additions and 3 deletions

View file

@ -10,13 +10,18 @@ urlparse.uses_netloc.append('sqlite')
DEFAULT_ENV = 'DATABASE_URL'
def config(env=DEFAULT_ENV):
def config(env=DEFAULT_ENV, default=None):
"""Returns configured DATABASE dictionary from DATABASE_URL."""
config = {}
if env in os.environ:
config = parse(os.environ[env])
s = os.environ[env]
else:
s = default
if s:
config = parse()
return config

View file

@ -23,7 +23,7 @@ from setuptools import setup
setup(
name='dj-database-url',
version='0.1.3',
version='0.1.4',
url='https://github.com/kennethreitz/dj-database-url',
license='BSD',
author='Kenneth Reitz',