diff --git a/apps/signaler/management/commands/update_index.py b/apps/signaler/management/commands/update_index.py index bfc87a0fe0..e810de5b82 100644 --- a/apps/signaler/management/commands/update_index.py +++ b/apps/signaler/management/commands/update_index.py @@ -1,3 +1,5 @@ +from optparse import make_option + from haystack.management.commands import update_index from signaler.signals import post_update_index, pre_update_index @@ -7,8 +9,12 @@ class Command(update_index.Command): """ Wrapper for the haystack's update_index command """ + option_list = update_index.Command.option_list + ( + make_option('--mayan_runtime', action='store_true', dest='mayan_runtime', default=False), + ) def handle(self, *args, **kwargs): - pre_update_index.send(sender=self) + mayan_runtime = kwargs.pop('mayan_runtime') + pre_update_index.send(sender=self, mayan_runtime=mayan_runtime) super(Command, self).handle(*args, **kwargs) - post_update_index.send(sender=self) + post_update_index.send(sender=self, mayan_runtime=mayan_runtime) diff --git a/apps/signaler/signals.py b/apps/signaler/signals.py index 66a764ab57..ae5c121049 100644 --- a/apps/signaler/signals.py +++ b/apps/signaler/signals.py @@ -1,5 +1,5 @@ from django.dispatch import Signal pre_collectstatic = Signal() -pre_update_index = Signal() -post_update_index = Signal() +pre_update_index = Signal(providing_args=['mayan_runtime']) +post_update_index = Signal(providing_args=['mayan_runtime'])