Cleanup of Gilbert plugins API and JavaScript.
[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_registry = copy.copy(site.model_registry)
17                         before_import_plugin_registry = copy.copy(site.plugin_registry)
18                         import_module('%s.gilbert' % app)
19                 except:
20                         site.model_registry = before_import_model_registry
21                         site.plugin_registry = before_import_plugin_registry
22                         
23                         if module_has_submodule(mod, 'gilbert'):
24                                 raise