Browse Source

--app argument: Make sure found attribute is not a module. Closes #1647

Ask Solem 11 years ago
parent
commit
23d2fbc6d8
1 changed files with 8 additions and 2 deletions
  1. 8 2
      celery/bin/base.py

+ 8 - 2
celery/bin/base.py

@@ -452,10 +452,14 @@ class Command(object):
             sym = import_from_cwd(app)
         if isinstance(sym, ModuleType):
             try:
-                return sym.app
+                found = sym.app
+                if isinstance(found, ModuleType):
+                    raise AttributeError()
             except AttributeError:
                 try:
-                    return sym.celery
+                    found = sym.celery
+                    if isinstance(found, ModuleType):
+                        raise AttributeError()
                 except AttributeError:
                     if getattr(sym, '__path__', None):
                         try:
@@ -468,6 +472,8 @@ class Command(object):
                         if isinstance(suspect, Celery):
                             return suspect
                     raise
+            else:
+                return found
         return sym
 
     def symbol_by_name(self, name):