From: Kirill Spitsin Date: Fri, 24 May 2013 14:51:07 +0000 (+0200) Subject: Changed View.add_job() to actually add job to the view, rather than replace all jobs... X-Git-Tag: v0.2.23~239^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43ac50d92d3d21f029ea8b10a6d2983ca7aecc72;p=tools%2Fpython-jenkinsapi.git Changed View.add_job() to actually add job to the view, rather than replace all jobs in the view by that job. --- diff --git a/jenkinsapi/view.py b/jenkinsapi/view.py index e489006..b270f31 100644 --- a/jenkinsapi/view.py +++ b/jenkinsapi/view.py @@ -62,6 +62,10 @@ class View(JenkinsBase): elif not self.get_jenkins_obj().has_job(str_job_name): return "Job %s is not known - available: %s" % ( str_job_name, ", ".join(self.get_jenkins_obj().get_jobs_list())) else: + def get_job_url(name): + return self.jenkins_obj.get_job(name).baseurl + jobs = self._data.setdefault('jobs', []) + jobs.append({'name': str_job_name, 'url': get_job_url(str_job_name)}) data = { "description":"", "statusFilter":"", @@ -79,7 +83,6 @@ class View(JenkinsBase): data["name"] = self.name for job in self.get_job_dict().keys(): data[job]='on' - data[str_job_name] = "on" data['json'] = data.copy() self.post_data('%sconfigSubmit' % self.baseurl, urllib.urlencode(data)) return "Job %s is add in View %s successful" % (str_job_name, self.baseurl)