From: Aleksey Maksimov Date: Fri, 25 Apr 2014 13:33:31 +0000 (+0800) Subject: build.get_console() now returns string in all python versions X-Git-Tag: v0.2.23~20^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83944b5c09ae4aee011a0b9345911be89b3a1862;p=tools%2Fpython-jenkinsapi.git build.get_console() now returns string in all python versions --- diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index a235531..30acd3d 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -364,7 +364,16 @@ class Build(JenkinsBase): Return the current state of the text console. """ url = "%s/consoleText" % self.baseurl - return self.job.jenkins.requester.get_url(url).content.decode('utf-8') + content = self.job.jenkins.requester.get_url(url).content + # This check was made for Python 3.x + # In this version content is a bytes string + # By contract this function must return string + if isinstance(content, str): + return content + elif isinstance(content, bytes): + return content.decode('utf-8') + else: + raise JenkinsAPIException('Unknown content type for console') def stop(self): """