Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec185cf

Browse files
committed
Fix encoding error when updating with redirected output
When output is redirected sys.stdout.encoding is None. Fix this byalways encoding to utf-8, assuming gitlab handles that. The encodingused by the local system is irrelevant here.
1 parente236fd9 commitec185cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎gitlab.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def __init__(self, url, private_token=None,
8989
self.email=email
9090
self.password=password
9191
self.ssl_verify=ssl_verify
92+
# Gitlab should handle UTF-8
93+
self.gitlab_encoding='UTF-8'
9294

9395
defauth(self):
9496
"""Performs an authentication using either the private token, or the
@@ -302,7 +304,7 @@ def update(self, obj):
302304
iftype(v)in (int,str,bool):
303305
d[k]=str(v)
304306
eliftype(v)==unicode:
305-
d[k]=str(v.encode(sys.stdout.encoding,"replace"))
307+
d[k]=str(v.encode(self.gitlab_encoding,"replace"))
306308

307309
try:
308310
r=requests.put(url,d,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp