Skip to content

Commit

Permalink
Fix properties default value (#281)
Browse files Browse the repository at this point in the history
* Fix properties default value

* Add default value to getattr to avoid exception
  • Loading branch information
KOliver94 committed Jan 26, 2022
1 parent 5f47db6 commit cf17067
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion django_celery_results/backends/database.py
Expand Up @@ -40,7 +40,7 @@ def _store_result(
)

task_name = getattr(request, 'task', None)
properties = getattr(request, 'properties', {})
properties = getattr(request, 'properties', {}) or {}
periodic_task_name = properties.get('periodic_task_name', None)
worker = getattr(request, 'hostname', None)

Expand Down
2 changes: 1 addition & 1 deletion t/unit/backends/test_database.py
Expand Up @@ -45,7 +45,7 @@ def _create_request(self, task_id, name, args, kwargs,
)
if task_protocol == 1:
body, headers, _, _ = hybrid_to_proto2(msg, msg.body)
properties = {}
properties = None
sent_event = {}
else:
headers, properties, body, sent_event = msg
Expand Down

0 comments on commit cf17067

Please sign in to comment.