diff options
author | Dirk Thomas <dthomas@osrfoundation.org> | 2014-11-20 11:40:41 -0800 |
---|---|---|
committer | Dirk Thomas <dthomas@osrfoundation.org> | 2014-11-20 11:46:11 -0800 |
commit | 84e13c8f7501a190f542b3b8343ede61585e8ba8 (patch) | |
tree | f083dc8563b7bb4db71bbef1ac8c26ffa7aa1003 | |
parent | d0ed211b8415ccf38628c81b3ca0a429bc7da90d (diff) | |
download | python-jenkinsapi-84e13c8f7501a190f542b3b8343ede61585e8ba8.tar.gz python-jenkinsapi-84e13c8f7501a190f542b3b8343ede61585e8ba8.tar.bz2 python-jenkinsapi-84e13c8f7501a190f542b3b8343ede61585e8ba8.zip |
add update_config() to view
-rw-r--r-- | jenkinsapi/view.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/jenkinsapi/view.py b/jenkinsapi/view.py index e06361f..69ecbf0 100644 --- a/jenkinsapi/view.py +++ b/jenkinsapi/view.py @@ -167,6 +167,25 @@ class View(JenkinsBase): def get_nested_view_dict(self): return dict(self._get_nested_views()) + def get_config_xml_url(self): + return '%s/config.xml' % self.baseurl + + def update_config(self, config): + """ + Update the config.xml to the view + """ + url = self.get_config_xml_url() + try: + if isinstance(config, unicode): # pylint: disable=undefined-variable + config = str(config) + except NameError: + # Python3 already a str + pass + + response = self.get_jenkins_obj().requester.post_url( + url, params={}, data=config) + return response.text + @property def views(self): return self.get_jenkins_obj().get_jenkins_obj_from_url(self.baseurl).views |