torchbox/wagtail — pull request #446 by nimasmi (2014-07-09 10:14:52+00:00)
Title: Detect presence of wagtail_hooks modules before importing

This addresses #398, by using `imp.find_module()` to determine whether the `wagtail_hooks.py` file exists as a module and is importable for each of the Python paths listed in `settings.INSTALLED_APPS`. Local 'checking' in Python 2.7 and 3.2 confirms that `raise ImportError` in a module's `views.py` does indeed raise properly, but I'm a bit at a loss about how one would write a test for this.

Note that `imp.find_module()` is [deprecated since Python 3.3](https://docs.python.org/3.4/library/imp.html?highlight=imp#imp.find_module).