Skip to content

Commit b443027

Browse files
committed
Fix using binary strings as property values
Previously it'd fall trough and set the value to False
1 parent 2190818 commit b443027

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

zeroconf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from functools import reduce
3939

4040
import netifaces
41-
from six import indexbytes, int2byte, text_type
41+
from six import binary_type, indexbytes, int2byte, iteritems, text_type
4242
from six.moves import xrange
4343

4444

@@ -1085,15 +1085,16 @@ def _set_properties(self, properties):
10851085
self._properties = properties
10861086
list = []
10871087
result = b''
1088-
for key in properties:
1089-
value = properties[key]
1088+
for key, value in iteritems(properties):
10901089
if isinstance(key, text_type):
10911090
key = key.encode('utf-8')
10921091

10931092
if value is None:
10941093
suffix = b''
10951094
elif isinstance(value, text_type):
10961095
suffix = value.encode('utf-8')
1096+
elif isinstance(value, binary_type):
1097+
suffix = value
10971098
elif isinstance(value, int):
10981099
if value:
10991100
suffix = b'true'

0 commit comments

Comments
 (0)