Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #537 from CSCfi/CSCFAIRMETA-470-Error-updating-dat…
Browse files Browse the repository at this point in the history
…aset

 CSCFAIRMETA-470-Error-updating-dataset: fix to datetime serialization.
  • Loading branch information
Katri Tegel authored Feb 19, 2020
2 parents 798a285 + 8e4c974 commit 139428f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/metax_api/services/rabbitmq_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import pika
from django.conf import settings as django_settings
from django.core.serializers.json import DjangoJSONEncoder

from metax_api.utils.utils import executing_test_case, executing_travis

Expand Down Expand Up @@ -84,7 +85,9 @@ def publish(self, body, routing_key='', exchange=None, persistent=True):
try:
for message in messages:
if isinstance(message, dict):
message = json_dumps(message)
message = json_dumps(
message,
cls=DjangoJSONEncoder)
self._channel.basic_publish(body=message, routing_key=routing_key, exchange=exchange, **additional_args)
except Exception as e:
_logger.error(e)
Expand Down

0 comments on commit 139428f

Please sign in to comment.