Browse Source

Repr of old task class now shows "v2 compatible"

Ask Solem 12 years ago
parent
commit
19d54ef148
2 changed files with 4 additions and 0 deletions
  1. 3 0
      celery/app/task.py
  2. 1 0
      celery/task/base.py

+ 3 - 0
celery/app/task.py

@@ -127,6 +127,8 @@ class TaskType(type):
     def __repr__(cls):
         if cls._app:
             return '<class %s of %s>' % (cls.__name__, cls._app, )
+        if cls.__v2_compat__:
+            return '<unbound %s (v2 compatible)>' % (cls.__name__, )
         return '<unbound %s>' % (cls.__name__, )
 
 
@@ -140,6 +142,7 @@ class Task(object):
     """
     __metaclass__ = TaskType
     __trace__ = None
+    __v2_compat__ = False  # set by old base in celery.task.base
 
     ErrorMail = ErrorMail
     MaxRetriesExceededError = MaxRetriesExceededError

+ 1 - 0
celery/task/base.py

@@ -34,6 +34,7 @@ class Task(BaseTask):
     """
     abstract = True
     __bound__ = False
+    __v2_compat__ = True
 
     #- Deprecated compat. attributes -: