Commit 1bec3073 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: user's git information can now contain utf-8 characters

parent 89ad1d9e
...@@ -39,7 +39,7 @@ def updateGitConfig(repository, user, email): ...@@ -39,7 +39,7 @@ def updateGitConfig(repository, user, email):
repo = Repo(repository) repo = Repo(repository)
config_writer = repo.config_writer() config_writer = repo.config_writer()
if user != "": if user != "":
config_writer.set_value("user", "name", user.encode("utf-8")) config_writer.set_value("user", "name", user)
if email != "": if email != "":
config_writer.set_value("user", "email", email) config_writer.set_value("user", "email", email)
config_writer.release() config_writer.release()
......
...@@ -118,7 +118,7 @@ def manageRepository(): ...@@ -118,7 +118,7 @@ def manageRepository():
git_user_path = os.path.join(app.config['etc_dir'], '.git_user') git_user_path = os.path.join(app.config['etc_dir'], '.git_user')
name = email = "" name = email = ""
if os.path.exists(git_user_path): if os.path.exists(git_user_path):
with open(git_user_path, 'r') as gfile: with codecs.open(git_user_path, 'r', encoding='utf-8') as gfile:
name, email = gfile.read().split(';') name, email = gfile.read().split(';')
return render_template('manageRepository.html', workDir='workspace', return render_template('manageRepository.html', workDir='workspace',
project=listFolder(app.config, 'workspace'), project=listFolder(app.config, 'workspace'),
...@@ -633,8 +633,9 @@ def updateAccount(): ...@@ -633,8 +633,9 @@ def updateAccount():
updateGitConfig(app.config['default_repository_path'], name, email) updateGitConfig(app.config['default_repository_path'], name, email)
except GitCommandError, e: except GitCommandError, e:
return jsonify(code=0, result=str(e)) return jsonify(code=0, result=str(e))
with open(os.path.join(app.config['etc_dir'], '.git_user'), 'w') as gfile: git_user_file = os.path.join(app.config['etc_dir'], '.git_user')
gfile.write('%s;%s' % (name, email)) with codecs.open(git_user_file, 'w', encoding='utf-8') as gfile:
gfile.write(u'{};{}'.format(name, email))
return jsonify(code=1, result="") return jsonify(code=1, result="")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment