Skip to content

Commit

Permalink
make rest service py2/py3 compatible
Browse files Browse the repository at this point in the history
New UI branch updates altered things slightly
  • Loading branch information
Madison Bahmer committed Aug 1, 2017
1 parent 229bdce commit 5a2bf12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion rest/rest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import logging
import json
import threading
from six import string_types

from kafka import KafkaConsumer, KafkaProducer
from kafka.common import KafkaError
Expand All @@ -40,7 +41,7 @@

def crossdomain(origin='*', max_age=21600, attach_to_all=True, automatic_options=True):

if not isinstance(origin, basestring):
if not isinstance(origin, string_types):
origin = ', '.join(origin)
if isinstance(max_age, timedelta):
max_age = max_age.total_seconds()
Expand Down
4 changes: 2 additions & 2 deletions rest/tests/test_rest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def fancy_get_time():
data = json.loads(results.data)
self.assertEquals(data, d)
self.assertEquals(results.status_code, 200)
self.assertFalse(self.rest_service.uuids.has_key('key'))
self.assertFalse('key' in self.rest_service.uuids)


# test with uuid, no response
Expand All @@ -612,7 +612,7 @@ def fancy_get_time2():
data = json.loads(results.data)
self.assertEquals(data, d)
self.assertEquals(results.status_code, 200)
self.assertTrue(self.rest_service.uuids.has_key('key'))
self.assertTrue('key' in self.rest_service.uuids)
self.assertEquals(self.rest_service.uuids['key'], 'poll')

def test_poll(self):
Expand Down

0 comments on commit 5a2bf12

Please sign in to comment.