Add the mayan_runtime option to the intercepted update_index command

This commit is contained in:
Roberto Rosario
2012-05-21 15:51:56 -04:00
parent 1c2a89e3e8
commit ce0082ee3f
2 changed files with 10 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
from optparse import make_option
from haystack.management.commands import update_index from haystack.management.commands import update_index
from signaler.signals import post_update_index, pre_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 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): 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) super(Command, self).handle(*args, **kwargs)
post_update_index.send(sender=self) post_update_index.send(sender=self, mayan_runtime=mayan_runtime)

View File

@@ -1,5 +1,5 @@
from django.dispatch import Signal from django.dispatch import Signal
pre_collectstatic = Signal() pre_collectstatic = Signal()
pre_update_index = Signal() pre_update_index = Signal(providing_args=['mayan_runtime'])
post_update_index = Signal() post_update_index = Signal(providing_args=['mayan_runtime'])