Skip to content

Commit

Permalink
Fixed a NoneType error when the callback is not defined in project se…
Browse files Browse the repository at this point in the history
…ttings.
  • Loading branch information
diegocastrum committed Aug 16, 2022
1 parent dbd822c commit 0149a54
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions django_celery_results/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

def get_callback_function(settings_name, default=None):
"""Return the callback function for the given settings name."""

callback = getattr(settings, settings_name, None)
if not callback:
return default
Expand All @@ -22,12 +21,11 @@ def get_callback_function(settings_name, default=None):


def get_task_props_extension(request, task_props):
"""Extend the task properties with custom properties to fill custom models."""

task_props_extension = extend_task_props_callback(request, task_props) or {}
if task_props_extension is None:
"""Extend the task properties with custom props to fill custom models."""
if not extend_task_props_callback:
return {}

task_props_extension = extend_task_props_callback(request, task_props) or {}
if not isinstance(task_props_extension, Mapping):
raise ImproperlyConfigured(
"CELERY_RESULTS_EXTEND_TASK_PROPS_CALLBACK must return a Mapping "
Expand Down

0 comments on commit 0149a54

Please sign in to comment.