Browse Source

Merge d8782dc594 into 3cb904cfd8

pull/5/merge
fejesd 10 years ago
parent
commit
48869d827a
  1. 25
      socketio/packet.py

25
socketio/packet.py

@ -141,15 +141,18 @@ class Packet(object):
def _data_is_binary(self, data): def _data_is_binary(self, data):
"""Check if the data contains binary components.""" """Check if the data contains binary components."""
if isinstance(data, six.binary_type): try:
return True if isinstance(data, six.binary_type):
elif isinstance(data, list): return True
return functools.reduce( elif isinstance(data, list):
lambda a, b: a or b, [self._data_is_binary(item) return functools.reduce(
for item in data]) lambda a, b: a or b, [self._data_is_binary(item)
elif isinstance(data, dict): for item in data])
return functools.reduce( elif isinstance(data, dict):
lambda a, b: a or b, [self._data_is_binary(item) return functools.reduce(
for item in six.itervalues(data)]) lambda a, b: a or b, [self._data_is_binary(item)
else: for item in six.itervalues(data)])
else:
return False
except TypeError:
return False return False

Loading…
Cancel
Save