From 67a893d5219824e50d0f018901fc50a4b29378eb Mon Sep 17 00:00:00 2001 From: lukasheinrich Date: Tue, 21 Nov 2017 14:33:15 +0100 Subject: [PATCH] use six to check string types --- packtivity/handlers/publisher_handlers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packtivity/handlers/publisher_handlers.py b/packtivity/handlers/publisher_handlers.py index 9d3a47b..db61eee 100644 --- a/packtivity/handlers/publisher_handlers.py +++ b/packtivity/handlers/publisher_handlers.py @@ -6,6 +6,8 @@ import logging import jq import os +from six import string_types + import packtivity.utils as utils @@ -26,7 +28,7 @@ def interpolated_pub_handler(publisher,parameters,state): forinterp.update(workdir = state.readwrite[0]) result = copy.deepcopy(publisher['publish']) for path,value in utils.leaf_iterator(publisher['publish']): - if not type(value) in [str, unicode]: continue + if not isinstance(value, string_types): continue resultval = value.format(**forinterp) globexpr = resultval if publisher['relative_paths'] and os.path.commonprefix([state.readwrite[0],globexpr]) == '': @@ -55,7 +57,7 @@ def fromparjq_pub(publisher,parameters,state): result = jq.jq(publisher['script']).transform(inputjson) assert type(result)==dict for path,value in utils.leaf_iterator(result): - if not type(value) in [str, unicode]: continue + if not isinstance(value, string_types): continue if not state: break if state.readwrite: globdir = state.readwrite[0]