Skip to content

Commit 948bdf8

Browse files
committed
Fixed a NoneType error when the callback is not defined in project settings.
1 parent 23b9cd5 commit 948bdf8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

django_celery_results/settings.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
def get_callback_function(settings_name, default=None):
77
"""Return the callback function for the given settings name."""
8-
98
callback = getattr(settings, settings_name, None)
109
if not callback:
1110
return default
@@ -22,12 +21,11 @@ def get_callback_function(settings_name, default=None):
2221

2322

2423
def get_task_props_extension(request, task_props):
25-
"""Extend the task properties with custom properties to fill custom models."""
26-
27-
task_props_extension = extend_task_props_callback(request, task_props) or {}
28-
if task_props_extension is None:
24+
"""Extend the task properties with custom props to fill custom models."""
25+
if not extend_task_props_callback:
2926
return {}
3027

28+
task_props_extension = extend_task_props_callback(request, task_props) or {}
3129
if not isinstance(task_props_extension, Mapping):
3230
raise ImproperlyConfigured(
3331
"CELERY_RESULTS_EXTEND_TASK_PROPS_CALLBACK must return a Mapping "

0 commit comments

Comments
 (0)