Changeset - b095a92a4312
[Not reviewed]
default
0 3 0
Mads Kiilerich (mads) - 5 years ago 2020-10-29 11:38:10
mads@kiilerich.com
Grafted from: ef144335e79a
lib: drop h.email alias - use vcs.utils directly
3 files changed with 6 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/files.py
Show inline comments
 
@@ -51,6 +51,7 @@ from kallithea.lib.vcs.conf import setti
 
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 @@ class FilesController(BaseRepoController
 

	
 
                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 @@ class FilesController(BaseRepoController
 
            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)
kallithea/lib/helpers.py
Show inline comments
 
@@ -542,8 +542,6 @@ def pop_flash_messages():
 
def capitalize(x):
 
    return x.capitalize()
 

	
 
email = author_email
 

	
 
def short_id(x):
 
    return x[:12]
 

	
 
@@ -636,7 +634,7 @@ def person(author, show_attr="username")
 
        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"):
kallithea/model/db.py
Show inline comments
 
@@ -49,6 +49,7 @@ from kallithea.lib.exceptions import Def
 
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 @@ class User(meta.Base, BaseDbModel):
 
    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:
0 comments (0 inline, 0 general)