diff --git a/README.markdown b/README.markdown index 49291ae..9fd50c6 100644 --- a/README.markdown +++ b/README.markdown @@ -144,7 +144,7 @@ The @task Decorator from django_ztask.decorators import task -The `@task()` decorator will turn any normal function in to a +The `@task` decorator will turn any normal function in to a `django_ztask` task if called using one of the function extensions. Function extensions @@ -172,7 +172,7 @@ Example from django_ztask.decorators import task - @task() + @task def print_this(what_to_print): print what_to_print diff --git a/django_ztask/decorators.py b/django_ztask/decorators.py index fa5c298..88b253f 100644 --- a/django_ztask/decorators.py +++ b/django_ztask/decorators.py @@ -4,7 +4,7 @@ import logging import types -def task(): +def task(function=None): from django_ztask.conf import settings try: from zmq import PUSH @@ -63,4 +63,7 @@ def _func_after(*args, **kwargs): setattr(func, 'after', _func_after) return func + if function: + return wrapper(function) + return wrapper