# HG changeset patch # User Andrew Shadura # Date 2014-01-12 17:30:00 # Node ID 5ebd887522eaa8c3cef8bd70e10f32eefe0ac41a # Parent f2014e4249a4dfc616b4e8001f93359951c5b23d helpers: user email can be unset Check for not being empty, not for ''. Also, don't call person() with email, as it can't be caught properly. diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -478,7 +478,7 @@ def is_hg(repository): def email_or_none(author): # extract email from the commit string _email = email(author) - if _email != '': + if _email: # check it against Kallithea database, and use the MAIN email for this # user user = User.get_by_email(_email, case_insensitive=True, cache=True) @@ -506,7 +506,7 @@ def person(author, show_attr="username") # Valid email in the attribute passed, see if they're in the system _email = email(author) - if _email != '': + if _email: user = User.get_by_email(_email, case_insensitive=True, cache=True) if user is not None: return person_getter(user) diff --git a/kallithea/model/comment.py b/kallithea/model/comment.py --- a/kallithea/model/comment.py +++ b/kallithea/model/comment.py @@ -105,7 +105,7 @@ class ChangesetCommentsModel(BaseModel): recipients += [cs_author] email_kwargs = { 'status_change': status_change, - 'cs_comment_user': h.person(user.email), + 'cs_comment_user': h.person(user), 'cs_target_repo': h.url('summary_home', repo_name=repo.repo_name, qualified=True), 'cs_comment_url': _url, @@ -147,7 +147,7 @@ class ChangesetCommentsModel(BaseModel): 'status_change': status_change, 'closing_pr': closing_pr, 'pr_comment_url': _url, - 'pr_comment_user': h.person(user.email), + 'pr_comment_user': h.person(user), 'pr_target_repo': h.url('summary_home', repo_name=pull_request.other_repo.repo_name, qualified=True) diff --git a/kallithea/model/pull_request.py b/kallithea/model/pull_request.py --- a/kallithea/model/pull_request.py +++ b/kallithea/model/pull_request.py @@ -134,7 +134,7 @@ class PullRequestModel(BaseModel): body = pr.description kwargs = { 'pr_title': pr.title, - 'pr_user_created': h.person(pr.author.email), + 'pr_user_created': h.person(pr.author), 'pr_repo_url': h.url('summary_home', repo_name=pr.other_repo.repo_name, qualified=True,), 'pr_url': pr_url,