From: Lars Wirzenius Date: Thu, 2 Aug 2012 23:04:26 +0000 (+0100) Subject: Make final return statement be useful X-Git-Tag: v0.2.23~278^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6ea6470afe8766b9c6d892ce05444ab69d2c7fa;p=tools%2Fpython-jenkinsapi.git Make final return statement be useful The final return statement was not useful: it was dead code, and was never executed, since both the try and except branches of the exception handling were exiting the method before the final return statement was reached. Change the method to follow the structure of the get_data method, by assigning the return value of urlopen into a variable, which the final return statement then returns. --- diff --git a/jenkinsapi/jenkinsbase.py b/jenkinsapi/jenkinsbase.py index 97b81e3..390e094 100644 --- a/jenkinsapi/jenkinsbase.py +++ b/jenkinsapi/jenkinsbase.py @@ -76,7 +76,7 @@ class JenkinsBase(object): def post_data(self, url, content): try: urlopen = self.get_jenkins_obj().get_opener() - return urlopen(url, data=content).read().strip() + result = urlopen(url, data=content).read().strip() except urllib2.HTTPError, e: log.warn("Error post data %s" % url) log.exception(e)