Changeset - 180effeba219
[Not reviewed]
default
0 2 0
Mads Kiilerich (mads) - 5 years ago 2020-10-30 15:26:03
mads@kiilerich.com
Grafted from: 85a21fb6ceb3
model: it is a known layering violation to use helpers in model - import it lazily
2 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/model/notification.py
Show inline comments
 
@@ -33,7 +33,6 @@ from tg import app_globals
 
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 @@ class NotificationModel(object):
 
        :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 @@ class EmailNotificationModel(object):
 
        """
 
        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)
kallithea/model/repo.py
Show inline comments
 
@@ -33,7 +33,6 @@ import traceback
 
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 @@ class RepoModel(object):
 
        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 @@ class RepoModel(object):
 
        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 @@ class RepoModel(object):
 
                           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):
0 comments (0 inline, 0 general)