Compare commits

...
Author SHA1 Message Date
R. Richard dc76f1b732 Fix broken ZMQ messages 2020-05-07 09:47:35 +02:00
R. Richard f374cb7e46 Look up every module in the package 2020-02-03 16:45:42 +01:00
2 changed files with 16 additions and 3 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
from os.path import dirname, realpath, join from os.path import dirname, realpath, join
from setuptools import setup from setuptools import setup, find_packages
here = dirname(realpath(__file__)) here = dirname(realpath(__file__))
@@ -17,7 +17,7 @@ setup(
author='Avatao.com Innovative Learning Kft.', author='Avatao.com Innovative Learning Kft.',
author_email='support@avatao.com', author_email='support@avatao.com',
license='custom', license='custom',
packages=['tfw'], packages=find_packages(),
package_dir={'tfw': 'tfw'}, package_dir={'tfw': 'tfw'},
install_requires=requirements, install_requires=requirements,
extras_require={ extras_require={
+14 -1
View File
@@ -42,7 +42,8 @@ def deserialize_tfw_msg(*args):
""" """
Return message from TFW multipart data Return message from TFW multipart data
""" """
return _deserialize_all(*args)[1] envelope = _deserialize_all(*args)
return _repair_if_needed(envelope)
def _serialize_all(*args): def _serialize_all(*args):
@@ -84,6 +85,18 @@ def _deserialize_single(data):
return _decode_if_needed(data) return _decode_if_needed(data)
def _repair_if_needed(envelope):
"""
Quick fix for broken messages received from separate processes.
"""
if len(envelope) == 2:
return envelope[1]
for part in envelope:
if isinstance(part, dict):
return part
return {}
def _encode_if_needed(value): def _encode_if_needed(value):
""" """
Return input as bytes Return input as bytes