zedshaw/lamson — pull request #32 by david-moran (2014-05-16 08:12:48+00:00)
Title: Fixing a bug importing 3 or more level packages in boot_module

Hello,

First of all, lamson is a very useful library, so thank you very much for such great work. I think I have found a bug in lamson.utils package. The problem appears when I call import_setting() function passing a boot_module parameter with a 3 level package, for example, if I try to start a lamson instance with:

lamson start -boot spamtoso.config.boot [...]

The __import__ call returns 'spamtoso' package instead 'spamtoso.config' package, there is a simple console example to reproduce this feature:

david@debian:/tmp$ cd test/
david@debian:/tmp/test$ mkdir -p a/b/c
david@debian:/tmp/test$ > a/__init__.py ; > a/b/__init__.py ; > a/b/c/__init__.py
david@debian:/tmp/test$ > a/b/c/settings.py
david@debian:/tmp/test$ python
Python 2.7.6 (default, Mar 22 2014, 15:40:47)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> __import__('a.b.c.settings')

>>>

In this example you can see 'a' package is returned instead of a.b.c.

Regards