Skip to content

Commit

Permalink
Foolproof prevention via strict tuples. Fix celery#573 (celery#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
frost-nzcr4 authored and maxmalysh committed Jul 29, 2019
1 parent 73b3b89 commit 3ec8a39
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Looking for sponsor for working on django 1.11 to 2.2 support https://github.com

.. image:: https://user-images.githubusercontent.com/26336/59113881-917c5180-890b-11e9-9863-f5a98d0e235e.png

:Version: 3.3.0
:Version: 3.3.1
:Web: http://celeryproject.org/
:Download: http://pypi.python.org/pypi/django-celery/
:Source: http://github.com/celery/django-celery/
Expand Down
9 changes: 5 additions & 4 deletions djcelery/management/commands/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
class Command(CeleryCommand):
"""The celery command."""
help = 'celery commands, see celery help'
cc_options = CeleryCommand.options if CeleryCommand.options else []
base_options = base.get_options() if base.get_options() else []
preload_options = getattr(base, 'preload_options', []) or []
options = cc_options + base_options + preload_options
options = (
tuple(CeleryCommand.options) +
tuple(base.get_options()) +
tuple(getattr(base, 'preload_options', ()))
)

def run_from_argv(self, argv):
argv = self.handle_default_options(argv)
Expand Down
8 changes: 5 additions & 3 deletions djcelery/management/commands/celerybeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
class Command(CeleryCommand):
"""Run the celery periodic task scheduler."""
help = 'Old alias to the "celery beat" command.'
options = CeleryCommand.options
options += beat.get_options()
options += beat.preload_options
options = (
tuple(CeleryCommand.options) +
tuple(beat.get_options()) +
tuple(getattr(beat, 'preload_options', ()))
)

def handle(self, *args, **options):
beat.run(*args, **options)
8 changes: 5 additions & 3 deletions djcelery/management/commands/celerycam.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
class Command(CeleryCommand):
"""Run the celery curses event viewer."""
help = 'Takes snapshots of the clusters state to the database.'
options = CeleryCommand.options
options += ev.get_options()
options += ev.preload_options
options = (
tuple(CeleryCommand.options) +
tuple(ev.get_options()) +
tuple(getattr(ev, 'preload_options', ()))
)

def handle(self, *args, **options):
"""Handle the management command."""
Expand Down
8 changes: 5 additions & 3 deletions djcelery/management/commands/celeryd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
class Command(CeleryCommand):
"""Run the celery daemon."""
help = 'Old alias to the "celery worker" command.'
options = CeleryCommand.options
options += worker.get_options()
options += worker.preload_options
options = (
tuple(CeleryCommand.options) +
tuple(worker.get_options()) +
tuple(getattr(worker, 'preload_options', ()))
)

def handle(self, *args, **options):
worker.check_args(args)
Expand Down
9 changes: 7 additions & 2 deletions djcelery/management/commands/celerymon.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
class Command(CeleryCommand):
"""Run the celery monitor."""
help = 'Run the celery monitor'
options = CeleryCommand.options
options += (mon and mon.get_options() + mon.preload_options or ())
options = (
tuple(CeleryCommand.options) +
(
tuple(mon.get_options()) +
tuple(getattr(mon, 'preload_options', ()))
) if mon else ()
)

def handle(self, *args, **options):
"""Handle the management command."""
Expand Down
8 changes: 5 additions & 3 deletions djcelery/management/commands/djcelerymon.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def run(self):
class Command(CeleryCommand):
"""Run the celery curses event viewer."""
args = '[optional port number, or ipaddr:port]'
options = runserver.Command.option_list
options += ev.get_options()
options += ev.preload_options
options = (
tuple(runserver.Command.option_list) +
tuple(ev.get_options()) +
tuple(getattr(ev, 'preload_options', ()))
)

help = 'Starts Django Admin instance and celerycam in the same process.'
# see http://code.djangoproject.com/changeset/13319.
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.. image:: http://cloud.github.com/downloads/celery/celery/celery_128.png

:Version: 3.3.0
:Version: 3.3.1
:Web: http://celeryproject.org/
:Download: http://pypi.python.org/pypi/django-celery/
:Source: http://github.com/celery/django-celery/
Expand Down

0 comments on commit 3ec8a39

Please sign in to comment.