From a086fcf736a5c382fac5fd547db2eb9be8cd4c79 Mon Sep 17 00:00:00 2001 From: Ivan Larin Date: Thu, 5 Dec 2013 19:22:56 +0700 Subject: [PATCH 1/2] decorator without brackets --- django_ztask/decorators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 From 8c99aacc0762ee25867b22e5991b6e9cce4fb635 Mon Sep 17 00:00:00 2001 From: Ivan Larin Date: Thu, 5 Dec 2013 19:37:50 +0700 Subject: [PATCH 2/2] remove unnecessary brackets from readme --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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