Skip to content

Commit

Permalink
Merge pull request #21 from lenary/override-settings-via-boot
Browse files Browse the repository at this point in the history
Allow overriding Lamson settings module
  • Loading branch information
zedshaw committed Feb 26, 2013
2 parents 448e6d1 + 222f4ec commit c392c16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lamson/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def import_settings(boot_also, from_dir=None, boot_module="config.boot"):
if from_dir:
sys.path.append(from_dir)

settings = __import__("config.settings", globals(), locals()).settings
# Assumes that the settings.py has the same parent module as boot.py
# ie config.boot -> config.settings (just changes the name of the last module)
settings_module = ".".join( [ boot_module.rsplit(".", 1)[0], "settings" ] )

settings = __import__(settings_module, globals(), locals()).settings

if boot_also:
__import__(boot_module, globals(), locals())
Expand Down

0 comments on commit c392c16

Please sign in to comment.