title: Decorator after @task decorator in celery
body: <p>I'm trying to apply a decorator after the celery @task decorator, something like.</p>
  
  <pre><code>@send_email
  @task
  def any_function():
  
     print "inside the function"
  </code></pre>
  
  <p>I can get it to work in the way it is recommended in the docs, i.e. to put the decorator before the task decorator, but in this case I would like to access the task instance in my decorator.</p>
  
  <p>The @send_email would have to be a class decorator, this is what I tried without success:</p>
  
  <pre><code>class send_email(object):
      ''' wraps a Task celery class '''
      def __init__(self, obj):
  
          self.wrapped_obj = obj
  
          functools.update_wrapper(self, obj)
  
      def __call__(self, *args, **kwargs):
  
          print "call"
  
          return self.wrapped_obj.__call__(*args, **kwargs)
  
      def run(self, *args, **kwargs):
  
          print "run"
  
          return self.wrapped_obj.__call__(*args, **kwargs)
  
      def __getattr__(self, attr):
  
          if attr in self.__dict__:
  
              return getattr(self, attr)
  
          return getattr(self.wrapped_obj, attr)
  </code></pre>
  
  <p>I can never get the print statement in the <strong>call</strong> or run function function to appear in either the worker or the caller.</p>
  
  <p>How can we decorate a celery Task, without resorting to class-based task definitions (so the decorator would be above @task above a function definition.</p>
  
  <p>Thanks for any help!</p>
  
  <p>Miguel</p>