Browse Source

TLS could be reset

Ask Solem 14 years ago
parent
commit
9000e19f21
1 changed files with 2 additions and 2 deletions
  1. 2 2
      celery/app/__init__.py

+ 2 - 2
celery/app/__init__.py

@@ -159,7 +159,7 @@ if os.environ.get("CELERY_TRACE_APP"):
         from traceback import print_stack
         from multiprocessing import current_process
         if app is None:
-            if _tls.current_app:
+            if getattr(_tls, "current_app", None):
                 print("-- RETURNING TO CURRENT APP --")
                 print_stack()
                 return _tls.current_app
@@ -179,5 +179,5 @@ else:
 
         """
         if app is None:
-            return _tls.current_app or default_app
+            return getattr(_tls, "current_app", None) or default_app
         return app