From 40ad7946f67422ba2ae1ae24bc78a34a28ed2ea0 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sat, 6 Jun 2009 20:29:09 +0200 Subject: [PATCH] Remove getCallback indirection in modules Instead, assume that the imported module contains the Callback class that was previously returned by getCallback. This is done to prevent a circular import (caused by the __init__ importing a submodule). --- app/settings.py | 2 +- app/soc/modules/core.py | 2 +- app/soc/modules/soc_core/__init__.py | 12 ------------ 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/app/settings.py b/app/settings.py index db1e36ae..42e7c8b5 100755 --- a/app/settings.py +++ b/app/settings.py @@ -110,5 +110,5 @@ INSTALLED_APPS = ( # 'django.contrib.sites', ) -MODULE_FMT = 'soc.modules.%s' +MODULE_FMT = 'soc.modules.%s.callback' MODULES = ['ghop'] diff --git a/app/soc/modules/core.py b/app/soc/modules/core.py index 3ce27f2c..56a607f0 100644 --- a/app/soc/modules/core.py +++ b/app/soc/modules/core.py @@ -190,7 +190,7 @@ class Core(object): modules = ['soc_core'] + settings.MODULES modules = [__import__(fmt % i, fromlist=['']) for i in modules] - for callback_class in [i.getCallback() for i in modules]: + for callback_class in [i.Callback for i in modules]: if callback_class.API_VERSION != self.API_VERSION: raise APIVersionMismatch(self.API_VERSION, callback_class.API_VERSION) diff --git a/app/soc/modules/soc_core/__init__.py b/app/soc/modules/soc_core/__init__.py index 1e1dbb6b..8b1321d6 100644 --- a/app/soc/modules/soc_core/__init__.py +++ b/app/soc/modules/soc_core/__init__.py @@ -15,15 +15,3 @@ """This is the main modules module. """ - -__authors__ = [ - '"Sverre Rabbelier" ', - '"Lennard de Rijk" ', - ] - - - -from soc.modules.soc_core import callback - -def getCallback(): - return callback.Callback -- 2.11.4.GIT