Mercurial > kallithea
changeset 8713:180effeba219
model: it is a known layering violation to use helpers in model - import it lazily
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 30 Oct 2020 15:26:03 +0100 |
parents | 1f8eaa4c1dff |
children | 7c30a3db0cdf |
files | kallithea/model/notification.py kallithea/model/repo.py |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/notification.py Wed Oct 28 21:24:13 2020 +0100 +++ b/kallithea/model/notification.py Fri Oct 30 15:26:03 2020 +0100 @@ -33,7 +33,6 @@ from tg import tmpl_context as c from tg.i18n import ugettext as _ -from kallithea.lib import helpers as h from kallithea.model import db @@ -66,6 +65,7 @@ :param with_email: send email with this notification :param email_kwargs: additional dict to pass as args to email template """ + import kallithea.lib.helpers as h from kallithea.lib.celerylib import tasks email_kwargs = email_kwargs or {} if recipients and not getattr(recipients, '__iter__', False): @@ -203,6 +203,7 @@ """ return generated template for email based on given type """ + import kallithea.lib.helpers as h base = 'email/' + self.email_types.get(type_, self.email_types[self.TYPE_DEFAULT]) + '.' + content_type email_template = self._tmpl_lookup.get_template(base)
--- a/kallithea/model/repo.py Wed Oct 28 21:24:13 2020 +0100 +++ b/kallithea/model/repo.py Fri Oct 30 15:26:03 2020 +0100 @@ -33,7 +33,6 @@ from datetime import datetime import kallithea.lib.utils2 -from kallithea.lib import helpers as h from kallithea.lib.auth import HasRepoPermissionLevel, HasUserGroupPermissionLevel from kallithea.lib.exceptions import AttachedForksError from kallithea.lib.hooks import log_delete_repository @@ -110,6 +109,8 @@ from tg import tmpl_context as c from tg.i18n import ugettext as _ + import kallithea.lib.helpers as h + _tmpl_lookup = app_globals.mako_lookup template = _tmpl_lookup.get_template('data_table/_dt_elements.html') @@ -129,6 +130,7 @@ from tg import request from tg import tmpl_context as c + import kallithea.lib.helpers as h from kallithea.model.scm import ScmModel def repo_lnk(name, rtype, rstate, private, fork_of): @@ -153,6 +155,7 @@ cs_cache.get('message')) def desc(desc): + import kallithea.lib.helpers as h return h.urlify_text(desc, truncate=80, stylize=c.visual.stylify_metalabels) def state(repo_state):