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.
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)