changeset 8715:b095a92a4312

lib: drop h.email alias - use vcs.utils directly
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 29 Oct 2020 11:38:10 +0100
parents 7c30a3db0cdf
children 95082c4dffe7
files kallithea/controllers/files.py kallithea/lib/helpers.py kallithea/model/db.py
diffstat 3 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/files.py	Thu Oct 29 11:04:49 2020 +0100
+++ b/kallithea/controllers/files.py	Thu Oct 29 11:38:10 2020 +0100
@@ -51,6 +51,7 @@
 from kallithea.lib.vcs.exceptions import (ChangesetDoesNotExistError, ChangesetError, EmptyRepositoryError, ImproperArchiveTypeError, NodeAlreadyExistsError,
                                           NodeDoesNotExistError, NodeError, RepositoryError, VCSError)
 from kallithea.lib.vcs.nodes import FileNode
+from kallithea.lib.vcs.utils import author_email
 from kallithea.lib.webutils import url
 from kallithea.model.repo import RepoModel
 from kallithea.model.scm import ScmModel
@@ -170,7 +171,7 @@
 
                 c.authors = []
                 for a in set([x.author for x in _hist]):
-                    c.authors.append((h.email(a), h.person(a)))
+                    c.authors.append((author_email(a), h.person(a)))
             else:
                 c.authors = c.file_history = []
         except RepositoryError as e:
@@ -222,7 +223,7 @@
             file_history, _hist = self._get_node_history(changeset, f_path)
             c.authors = []
             for a in set([x.author for x in _hist]):
-                c.authors.append((h.email(a), h.person(a)))
+                c.authors.append((author_email(a), h.person(a)))
             return render('files/files_history_box.html')
 
     @LoginRequired(allow_default_user=True)
--- a/kallithea/lib/helpers.py	Thu Oct 29 11:04:49 2020 +0100
+++ b/kallithea/lib/helpers.py	Thu Oct 29 11:38:10 2020 +0100
@@ -542,8 +542,6 @@
 def capitalize(x):
     return x.capitalize()
 
-email = author_email
-
 def short_id(x):
     return x[:12]
 
@@ -636,7 +634,7 @@
         return value
 
     # Still nothing?  Just pass back the author name if any, else the email
-    return author_name(author) or email(author)
+    return author_name(author) or author_email(author)
 
 
 def person_by_id(id_, show_attr="username"):
--- a/kallithea/model/db.py	Thu Oct 29 11:04:49 2020 +0100
+++ b/kallithea/model/db.py	Thu Oct 29 11:38:10 2020 +0100
@@ -49,6 +49,7 @@
 from kallithea.lib.utils2 import asbool, ascii_bytes, aslist, get_changeset_safe, get_clone_url, remove_prefix, safe_bytes, safe_int, safe_str, urlreadable
 from kallithea.lib.vcs import get_backend
 from kallithea.lib.vcs.backends.base import EmptyChangeset
+from kallithea.lib.vcs.utils import author_email, author_name
 from kallithea.lib.vcs.utils.helpers import get_scm
 from kallithea.model import meta
 
@@ -591,13 +592,9 @@
     def get_from_cs_author(cls, author):
         """
         Tries to get User objects out of commit author string
-
-        :param author:
         """
-        from kallithea.lib.helpers import author_name, email
-
         # Valid email in the attribute passed, see if they're in the system
-        _email = email(author)
+        _email = author_email(author)
         if _email:
             user = cls.get_by_email(_email)
             if user is not None: