From: salimfadhley Date: Wed, 26 Jun 2013 22:40:49 +0000 (+0100) Subject: apply the requested patch to solve issue #20 X-Git-Tag: v0.2.23~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3a19c917d83cba445a7b998e895b7bdd9fd7c90;p=tools%2Fpython-jenkinsapi.git apply the requested patch to solve issue #20 --- diff --git a/jenkinsapi/jenkins.py b/jenkinsapi/jenkins.py index 392bd40..c4b597d 100644 --- a/jenkinsapi/jenkins.py +++ b/jenkinsapi/jenkins.py @@ -87,15 +87,6 @@ class Jenkins(JenkinsBase): for info in self._data["jobs"]: yield info["url"], info["name"] - def get_jobs_list(self): - """ - return jobs dict,'name:url' - """ - jobs = [] - for info in self._data["jobs"]: - jobs.append(info["name"]) - return jobs - def get_job(self, jobname): """ Get a job by name @@ -204,6 +195,9 @@ class Jenkins(JenkinsBase): def keys(self): return [ a for a in self.iterkeys() ] + # This is a function alias we retain for historical compatibility + get_jobs_list = keys + def __str__(self): return "Jenkins server at %s" % self.baseurl @@ -221,9 +215,9 @@ class Jenkins(JenkinsBase): :param jobname: name of job, str :return: Job obj """ - for name, job in self.get_jobs(): - if name == jobname: - return job + for info in self._data["jobs"]: + if info["name"] == jobname: + return Job(info["url"], info["name"], jenkins_obj=self) raise UnknownJob(jobname) def __contains__(self, jobname):