Skip to content

Commit

Permalink
Support for using unicode characters in update_config
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoHsiao1 authored and lechat committed Aug 19, 2023
1 parent 284fa60 commit 5929fc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jenkinsapi/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def modify_scm_url(self, new_source_url, old_source_url=None):
def get_config_xml_url(self):
return "%s/config.xml" % self.baseurl

def update_config(self, config, full_response=False):
def update_config(self, config, full_response=False, encoding='utf-8'):
"""
Update the config.xml to the job
Also refresh the ElementTree object since the config has changed
Expand All @@ -637,7 +637,7 @@ def update_config(self, config, full_response=False):
"""
url = self.get_config_xml_url()
config = str(config) # cast unicode in case of Python 2
response = self.jenkins.requester.post_url(url, params={}, data=config)
response = self.jenkins.requester.post_url(url, params={}, data=config.encode(encoding))
self._element_tree = ET.fromstring(config)

if full_response:
Expand Down

0 comments on commit 5929fc4

Please sign in to comment.