# HG changeset patch # User Mads Kiilerich # Date 2018-06-09 14:30:22 # Node ID e2519d2e74c2e690a35f05cf44893a570e89bf97 # Parent 9937ae52f167858b01e0f6062f49ea04f9b76377 unicode: consistently use the preferred Python spelling 'utf-8' instead of the alias 'utf8' diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -158,7 +158,7 @@ api_access_controllers_whitelist = ## default encoding used to convert from and to unicode ## can be also a comma separated list of encoding in case of mixed encodings -default_encoding = utf8 +default_encoding = utf-8 ## Set Mercurial encoding, similar to setting HGENCODING before launching Kallithea hgencoding = utf-8 diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -475,7 +475,7 @@ def show_id(cs): def fmt_date(date): if date: - return date.strftime("%Y-%m-%d %H:%M:%S").decode('utf8') + return date.strftime("%Y-%m-%d %H:%M:%S").decode('utf-8') return "" diff --git a/kallithea/lib/middleware/pygrack.py b/kallithea/lib/middleware/pygrack.py --- a/kallithea/lib/middleware/pygrack.py +++ b/kallithea/lib/middleware/pygrack.py @@ -176,7 +176,7 @@ class GitRepository(object): update_server_info(repo._repo) resp = Response() - resp.content_type = 'application/x-%s-result' % git_command.encode('utf8') + resp.content_type = 'application/x-%s-result' % git_command.encode('utf-8') resp.charset = None resp.app_iter = out return resp diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -252,7 +252,7 @@ api_access_controllers_whitelist = <%text>## default encoding used to convert from and to unicode <%text>## can be also a comma separated list of encoding in case of mixed encodings -default_encoding = utf8 +default_encoding = utf-8 <%text>## Set Mercurial encoding, similar to setting HGENCODING before launching Kallithea hgencoding = utf-8 diff --git a/kallithea/lib/utils.py b/kallithea/lib/utils.py --- a/kallithea/lib/utils.py +++ b/kallithea/lib/utils.py @@ -435,7 +435,7 @@ def set_vcs_config(config): conf.settings.GIT_EXECUTABLE_PATH = config.get('git_path', 'git') conf.settings.GIT_REV_FILTER = config.get('git_rev_filter', '--all').strip() conf.settings.DEFAULT_ENCODINGS = aslist(config.get('default_encoding', - 'utf8'), sep=',') + 'utf-8'), sep=',') def set_indexer_config(config): diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py --- a/kallithea/lib/utils2.py +++ b/kallithea/lib/utils2.py @@ -176,7 +176,7 @@ def safe_unicode(str_, from_encoding=Non if not from_encoding: import kallithea DEFAULT_ENCODINGS = aslist(kallithea.CONFIG.get('default_encoding', - 'utf8'), sep=',') + 'utf-8'), sep=',') from_encoding = DEFAULT_ENCODINGS if not isinstance(from_encoding, (list, tuple)): @@ -225,7 +225,7 @@ def safe_str(unicode_, to_encoding=None) if not to_encoding: import kallithea DEFAULT_ENCODINGS = aslist(kallithea.CONFIG.get('default_encoding', - 'utf8'), sep=',') + 'utf-8'), sep=',') to_encoding = DEFAULT_ENCODINGS if not isinstance(to_encoding, (list, tuple)): diff --git a/kallithea/lib/vcs/backends/hg/inmemory.py b/kallithea/lib/vcs/backends/hg/inmemory.py --- a/kallithea/lib/vcs/backends/hg/inmemory.py +++ b/kallithea/lib/vcs/backends/hg/inmemory.py @@ -53,7 +53,7 @@ class MercurialInMemoryChangeset(BaseInM for node in self.added: if node.path == path: return memfilectx(_repo, memctx, path=node.path, - data=(node.content.encode('utf8') + data=(node.content.encode('utf-8') if not node.is_binary else node.content), islink=False, isexec=node.is_executable, @@ -63,7 +63,7 @@ class MercurialInMemoryChangeset(BaseInM for node in self.changed: if node.path == path: return memfilectx(_repo, memctx, path=node.path, - data=(node.content.encode('utf8') + data=(node.content.encode('utf-8') if not node.is_binary else node.content), islink=False, isexec=node.is_executable, diff --git a/kallithea/lib/vcs/conf/settings.py b/kallithea/lib/vcs/conf/settings.py --- a/kallithea/lib/vcs/conf/settings.py +++ b/kallithea/lib/vcs/conf/settings.py @@ -17,7 +17,7 @@ if os.path.isdir(VCSRC_PATH): VCSRC_PATH = os.path.join(VCSRC_PATH, '__init__.py') # list of default encoding used in safe_unicode/safe_str methods -DEFAULT_ENCODINGS = aslist('utf8') +DEFAULT_ENCODINGS = aslist('utf-8') # path to git executable run by run_git_command function GIT_EXECUTABLE_PATH = 'git' diff --git a/kallithea/tests/vcs/test_changesets.py b/kallithea/tests/vcs/test_changesets.py --- a/kallithea/tests/vcs/test_changesets.py +++ b/kallithea/tests/vcs/test_changesets.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# encoding: utf-8 import time import datetime diff --git a/kallithea/tests/vcs/test_filenodes_unicode_path.py b/kallithea/tests/vcs/test_filenodes_unicode_path.py --- a/kallithea/tests/vcs/test_filenodes_unicode_path.py +++ b/kallithea/tests/vcs/test_filenodes_unicode_path.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# encoding: utf-8 import datetime diff --git a/kallithea/tests/vcs/test_inmemchangesets.py b/kallithea/tests/vcs/test_inmemchangesets.py --- a/kallithea/tests/vcs/test_inmemchangesets.py +++ b/kallithea/tests/vcs/test_inmemchangesets.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# encoding: utf-8 """ Tests so called "in memory changesets" commit API of vcs. """ diff --git a/scripts/update-copyrights.py b/scripts/update-copyrights.py --- a/scripts/update-copyrights.py +++ b/scripts/update-copyrights.py @@ -143,7 +143,7 @@ def sortkey(x): return (x[0] and -int(x[0][-1]), x[0] and int(x[0][0]), -len(x[0]), - x[1].decode('utf8').lower().replace(u'\xe9', u'e').replace(u'\u0142', u'l') + x[1].decode('utf-8').lower().replace(u'\xe9', u'e').replace(u'\u0142', u'l') )