add get_view_by_url for myview or Nested View,what ever
authorWilliam Zhang <jollychang@gmail.com>
Thu, 17 May 2012 03:23:41 +0000 (11:23 +0800)
committerWilliam Zhang <jollychang@gmail.com>
Thu, 17 May 2012 03:23:41 +0000 (11:23 +0800)
jenkinsapi/jenkins.py

index ed4e0de296339943f354d18d450c46d51328a608..6179f0e37c666560d85e234b431195b74c126927 100644 (file)
@@ -155,6 +155,12 @@ class Jenkins(JenkinsBase):
         view_api_url = self.python_api_url(view_url)
         return View(view_api_url , str_view_name, jenkins_obj=self)
 
+    def get_view_by_url(self, str_url):
+        view_url = str_url
+        view_api_url = "%s/api/python/" % str_url
+        str_view_name = view_url.replace(self.baseurl, '')
+        return View(view_api_url, str_view_name, jenkins_obj=self)
+
     def __getitem__(self, jobname):
         """
         Get a job by name