changeset 7328:e2519d2e74c2

unicode: consistently use the preferred Python spelling 'utf-8' instead of the alias 'utf8'
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 09 Jun 2018 16:30:22 +0200
parents 9937ae52f167
children 401fe08bc6b8
files development.ini kallithea/lib/helpers.py kallithea/lib/middleware/pygrack.py kallithea/lib/paster_commands/template.ini.mako kallithea/lib/utils.py kallithea/lib/utils2.py kallithea/lib/vcs/backends/hg/inmemory.py kallithea/lib/vcs/conf/settings.py kallithea/tests/vcs/test_changesets.py kallithea/tests/vcs/test_filenodes_unicode_path.py kallithea/tests/vcs/test_inmemchangesets.py scripts/update-copyrights.py
diffstat 12 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Sat Jun 09 16:28:33 2018 +0200
+++ b/development.ini	Sat Jun 09 16:30:22 2018 +0200
@@ -158,7 +158,7 @@
 
 ## 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
--- a/kallithea/lib/helpers.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/helpers.py	Sat Jun 09 16:30:22 2018 +0200
@@ -475,7 +475,7 @@
 
 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 ""
 
--- a/kallithea/lib/middleware/pygrack.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/middleware/pygrack.py	Sat Jun 09 16:30:22 2018 +0200
@@ -176,7 +176,7 @@
                 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
--- a/kallithea/lib/paster_commands/template.ini.mako	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/paster_commands/template.ini.mako	Sat Jun 09 16:30:22 2018 +0200
@@ -252,7 +252,7 @@
 
 <%text>## default encoding used to convert from and to unicode</%text>
 <%text>## can be also a comma separated list of encoding in case of mixed encodings</%text>
-default_encoding = utf8
+default_encoding = utf-8
 
 <%text>## Set Mercurial encoding, similar to setting HGENCODING before launching Kallithea</%text>
 hgencoding = utf-8
--- a/kallithea/lib/utils.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/utils.py	Sat Jun 09 16:30:22 2018 +0200
@@ -435,7 +435,7 @@
     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):
--- a/kallithea/lib/utils2.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/utils2.py	Sat Jun 09 16:30:22 2018 +0200
@@ -176,7 +176,7 @@
     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 @@
     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)):
--- a/kallithea/lib/vcs/backends/hg/inmemory.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/vcs/backends/hg/inmemory.py	Sat Jun 09 16:30:22 2018 +0200
@@ -53,7 +53,7 @@
             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 @@
             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,
--- a/kallithea/lib/vcs/conf/settings.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/lib/vcs/conf/settings.py	Sat Jun 09 16:30:22 2018 +0200
@@ -17,7 +17,7 @@
     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'
--- a/kallithea/tests/vcs/test_changesets.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/tests/vcs/test_changesets.py	Sat Jun 09 16:30:22 2018 +0200
@@ -1,4 +1,4 @@
-# encoding: utf8
+# encoding: utf-8
 
 import time
 import datetime
--- a/kallithea/tests/vcs/test_filenodes_unicode_path.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/tests/vcs/test_filenodes_unicode_path.py	Sat Jun 09 16:30:22 2018 +0200
@@ -1,4 +1,4 @@
-# encoding: utf8
+# encoding: utf-8
 
 import datetime
 
--- a/kallithea/tests/vcs/test_inmemchangesets.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/kallithea/tests/vcs/test_inmemchangesets.py	Sat Jun 09 16:30:22 2018 +0200
@@ -1,4 +1,4 @@
-# encoding: utf8
+# encoding: utf-8
 """
 Tests so called "in memory changesets" commit API of vcs.
 """
--- a/scripts/update-copyrights.py	Sat Jun 09 16:28:33 2018 +0200
+++ b/scripts/update-copyrights.py	Sat Jun 09 16:30:22 2018 +0200
@@ -143,7 +143,7 @@
     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')
         )