mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Encode GithubObject repr values in utf-8 when using Python2
This commit is contained in:
@@ -220,7 +220,10 @@ class GithubObject(object):
|
||||
else:
|
||||
items = list(params.items())
|
||||
for k, v in sorted(items, key=itemgetter(0), reverse=True):
|
||||
yield '{k}="{v}"'.format(k=k, v=v) if isinstance(v, (str, unicode)) else '{k}={v}'.format(k=k, v=v)
|
||||
isText = isinstance(v, (str, unicode))
|
||||
if isText and not atLeastPython3:
|
||||
v = v.encode('utf-8')
|
||||
yield '{k}="{v}"'.format(k=k, v=v) if isText else '{k}={v}'.format(k=k, v=v)
|
||||
return '{class_name}({params})'.format(
|
||||
class_name=self.__class__.__name__,
|
||||
params=", ".join(list(format_params(params)))
|
||||
|
||||
Reference in New Issue
Block a user