All of my work from commits: dd4a194, 692644a, 4a60203, 5de46bc, 152042d, 64a2d4e...
[philo.git] / contrib / gilbert / __init__.py
1 __version__ = 'alpha'
2
3
4 from philo.contrib.gilbert.sites import GilbertSite, site
5
6
7 def autodiscover():
8         import copy
9         from django.conf import settings
10         from django.utils.importlib import import_module
11         from django.utils.module_loading import module_has_submodule
12         
13         for app in settings.INSTALLED_APPS:
14                 mod = import_module(app)
15                 try:
16                         before_import_model_routers = copy.copy(site.model_routers)
17                         before_import_core_router = copy.copy(site.core_router)
18                         import_module('%s.gilbert' % app)
19                 except:
20                         site.model_routers = before_import_model_routers
21                         site.core_router = before_import_core_router
22                         
23                         if module_has_submodule(mod, 'gilbert'):
24                                 raise