From 59b22883948f01152da795bf802aa0d60ec9a12e Mon Sep 17 00:00:00 2001 From: Johan Berggren Date: Mon, 14 May 2012 15:56:57 +0200 Subject: Fix in autodiscover for consumer app. Updated settings for Django 1.4. Some small fixes in consumer.models --- coip/apps/consumer/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'coip/apps/consumer/__init__.py') diff --git a/coip/apps/consumer/__init__.py b/coip/apps/consumer/__init__.py index fd6cc15..5cfd0b1 100644 --- a/coip/apps/consumer/__init__.py +++ b/coip/apps/consumer/__init__.py @@ -1,4 +1,3 @@ - __author__ = 'leifj' from django.conf import settings @@ -8,9 +7,14 @@ _consumer_provider_modules = list() def autodiscover(): for app in settings.INSTALLED_APPS: - mod = import_module("%.models" % app) - if hasattr(mod,'consumer_providers' and hasattr(mod.consumer_providers,'__call__')): - _consumer_provider_modules.append(mod) + try: + mod = import_module("%s.models" % app) + except: continue + try: + if hasattr(mod,'consumer_providers') and hasattr(mod.consumer_providers,'__call__'): + _consumer_provider_modules.append(mod) + except AttributeError: + continue def consumer_providers(): p = list() -- cgit v1.1