decorators.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. """
  3. celery.decorators✞
  4. ==================
  5. Deprecated decorators, use `celery.task.task`,
  6. and `celery.task.periodic_task` instead.
  7. The new decorators does not support magic keyword arguments.
  8. :copyright: (c) 2009 - 2012 by Ask Solem.
  9. :license: BSD, see LICENSE for more details.
  10. """
  11. from __future__ import absolute_import
  12. import warnings
  13. from . import task as _task
  14. from .exceptions import CDeprecationWarning
  15. warnings.warn(CDeprecationWarning("""
  16. The `celery.decorators` module along with the magic keyword arguments,
  17. are deprecated, and will be removed in version 3.0.
  18. Please use the `celery.task` module instead of `celery.decorators`,
  19. and the `task.request` should be used instead of the magic keyword arguments:
  20. from celery.task import task
  21. See http://bit.ly/celery22major for more information.
  22. """))
  23. def task(*args, **kwargs): # ✞
  24. kwargs.setdefault("accept_magic_kwargs", True)
  25. return _task.task(*args, **kwargs)
  26. def periodic_task(*args, **kwargs): # ✞
  27. kwargs.setdefault("accept_magic_kwargs", True)
  28. return _task.periodic_task(*args, **kwargs)