Skip to content

Commit 37d11da

Browse files
frost-nzcr4auvipy
authored andcommitted
Foolproof prevention via strict tuples. Fix #573 (#576)
1 parent 7776d90 commit 37d11da

File tree

8 files changed

+34
-20
lines changed

8 files changed

+34
-20
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Looking for sponsor for working on django 1.11 to 2.2 support https://github.com
66

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

9-
:Version: 3.3.0
9+
:Version: 3.3.1
1010
:Web: http://celeryproject.org/
1111
:Download: http://pypi.python.org/pypi/django-celery/
1212
:Source: http://github.com/celery/django-celery/

djcelery/management/commands/celery.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
class Command(CeleryCommand):
1212
"""The celery command."""
1313
help = 'celery commands, see celery help'
14-
cc_options = CeleryCommand.options if CeleryCommand.options else []
15-
base_options = base.get_options() if base.get_options() else []
16-
preload_options = getattr(base, 'preload_options', []) or []
17-
options = cc_options + base_options + preload_options
14+
options = (
15+
tuple(CeleryCommand.options) +
16+
tuple(base.get_options()) +
17+
tuple(getattr(base, 'preload_options', ()))
18+
)
1819

1920
def run_from_argv(self, argv):
2021
argv = self.handle_default_options(argv)

djcelery/management/commands/celerybeat.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
class Command(CeleryCommand):
1717
"""Run the celery periodic task scheduler."""
1818
help = 'Old alias to the "celery beat" command.'
19-
options = CeleryCommand.options
20-
options += beat.get_options()
21-
options += beat.preload_options
19+
options = (
20+
tuple(CeleryCommand.options) +
21+
tuple(beat.get_options()) +
22+
tuple(getattr(beat, 'preload_options', ()))
23+
)
2224

2325
def handle(self, *args, **options):
2426
beat.run(*args, **options)

djcelery/management/commands/celerycam.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
class Command(CeleryCommand):
1717
"""Run the celery curses event viewer."""
1818
help = 'Takes snapshots of the clusters state to the database.'
19-
options = CeleryCommand.options
20-
options += ev.get_options()
21-
options += ev.preload_options
19+
options = (
20+
tuple(CeleryCommand.options) +
21+
tuple(ev.get_options()) +
22+
tuple(getattr(ev, 'preload_options', ()))
23+
)
2224

2325
def handle(self, *args, **options):
2426
"""Handle the management command."""

djcelery/management/commands/celeryd.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
class Command(CeleryCommand):
1717
"""Run the celery daemon."""
1818
help = 'Old alias to the "celery worker" command.'
19-
options = CeleryCommand.options
20-
options += worker.get_options()
21-
options += worker.preload_options
19+
options = (
20+
tuple(CeleryCommand.options) +
21+
tuple(worker.get_options()) +
22+
tuple(getattr(worker, 'preload_options', ()))
23+
)
2224

2325
def handle(self, *args, **options):
2426
worker.check_args(args)

djcelery/management/commands/celerymon.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
class Command(CeleryCommand):
3232
"""Run the celery monitor."""
3333
help = 'Run the celery monitor'
34-
options = CeleryCommand.options
35-
options += (mon and mon.get_options() + mon.preload_options or ())
34+
options = (
35+
tuple(CeleryCommand.options) +
36+
(
37+
tuple(mon.get_options()) +
38+
tuple(getattr(mon, 'preload_options', ()))
39+
) if mon else ()
40+
)
3641

3742
def handle(self, *args, **options):
3843
"""Handle the management command."""

djcelery/management/commands/djcelerymon.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ def run(self):
3232
class Command(CeleryCommand):
3333
"""Run the celery curses event viewer."""
3434
args = '[optional port number, or ipaddr:port]'
35-
options = runserver.Command.option_list
36-
options += ev.get_options()
37-
options += ev.preload_options
35+
options = (
36+
tuple(runserver.Command.option_list) +
37+
tuple(ev.get_options()) +
38+
tuple(getattr(ev, 'preload_options', ()))
39+
)
3840

3941
help = 'Starts Django Admin instance and celerycam in the same process.'
4042
# see http://code.djangoproject.com/changeset/13319.

docs/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
:Version: 3.3.0
7+
:Version: 3.3.1
88
:Web: http://celeryproject.org/
99
:Download: http://pypi.python.org/pypi/django-celery/
1010
:Source: http://github.com/celery/django-celery/

0 commit comments

Comments
 (0)