Skip to content

Commit 83ef918

Browse files
vytisbauvipy
authored andcommitted
Fix Django 1.10 argument parsing error (#485)
* [FIX] #467 django 1.10 manage.py startup error see #462 (comment) * Add test. * Update Changelog
1 parent 4c6d286 commit 83ef918

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Changelog

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
=====
1212
:release-date: TDB
1313

14-
- Now compatible with Django 1.9
14+
- Now compatible with Django 1.10
1515

1616
- Dropped compatibility with Django 1.7 and earlier.
1717

@@ -28,6 +28,10 @@
2828
- Fixed Django 1.10 compatibility issue in scheduler
2929

3030
Fix contributed by Mathieu Fenniak.
31+
32+
- Fixed Django 1.10 compatibility issue in management commands
33+
34+
Fix contributed by Stranger6667, yjmade and Vytis Banaitis.
3135

3236
- Fixed cache backend compatibility issue with Django 1.9
3337

djcelery/management/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def add_arguments(self, parser):
7272
option.get("_short_opts", []))
7373
if option.get('default') == ('NO', 'DEFAULT'):
7474
option['default'] = None
75+
if option.get("nargs") == 1:
76+
del option["nargs"]
7577
del option["_long_opts"]
7678
del option["_short_opts"]
7779
if "type" in option:

djcelery/tests/test_commands.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22
from django import VERSION
3-
from django.core.management import call_command
3+
from django.core.management import execute_from_command_line
44

55
from ._compat import patch
66

@@ -14,17 +14,18 @@ def test_celeryd_command():
1414
else:
1515
traceback = None
1616
with patch(CELERYD_COMMAND) as handle:
17-
call_command('celeryd')
17+
execute_from_command_line(['manage.py', 'celeryd', '--hostname=test',
18+
'--loglevel=info'])
1819
handle.assert_called_with(
1920
autoreload=None, autoscale=None, beat=None, broker=None,
2021
concurrency=0, detach=None, exclude_queues=[], executable=None,
21-
gid=None, heartbeat_interval=None, hostname=None, include=[],
22-
logfile=None, loglevel='WARN', max_tasks_per_child=None,
22+
gid=None, heartbeat_interval=None, hostname="test", include=[],
23+
logfile=None, loglevel='info', max_tasks_per_child=None,
2324
no_color=False, no_execv=False, optimization=None, pidfile=None,
2425
pool_cls='prefork', purge=False, pythonpath=None, queues=[],
2526
quiet=None, schedule_filename='celerybeat-schedule',
2627
scheduler_cls=None, send_events=False, settings=None,
27-
skip_checks=True, state_db=None, task_soft_time_limit=None,
28+
state_db=None, task_soft_time_limit=None,
2829
task_time_limit=None, traceback=traceback, uid=None, umask=None,
2930
verbosity=1, without_gossip=False, without_heartbeat=False,
3031
without_mingle=False, working_directory=None

0 commit comments

Comments
 (0)