diff --git a/kallithea/controllers/admin/repo_groups.py b/kallithea/controllers/admin/repo_groups.py
--- a/kallithea/controllers/admin/repo_groups.py
+++ b/kallithea/controllers/admin/repo_groups.py
@@ -36,7 +36,6 @@ from tg.i18n import ugettext as _
from tg.i18n import ungettext
from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound
-import kallithea.lib.helpers as h
from kallithea.controllers import base
from kallithea.lib import webutils
from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired
@@ -106,11 +105,11 @@ class RepoGroupsController(base.BaseCont
def repo_group_name(repo_group_name, children_groups):
return template.get_def("repo_group_name") \
- .render_unicode(repo_group_name, children_groups, _=_, h=h, c=c)
+ .render_unicode(repo_group_name, children_groups, _=_, webutils=webutils, c=c)
def repo_group_actions(repo_group_id, repo_group_name, gr_count):
return template.get_def("repo_group_actions") \
- .render_unicode(repo_group_id, repo_group_name, gr_count, _=_, h=h, c=c,
+ .render_unicode(repo_group_id, repo_group_name, gr_count, _=_, webutils=webutils, c=c,
ungettext=ungettext)
for repo_gr in group_iter:
diff --git a/kallithea/controllers/admin/user_groups.py b/kallithea/controllers/admin/user_groups.py
--- a/kallithea/controllers/admin/user_groups.py
+++ b/kallithea/controllers/admin/user_groups.py
@@ -89,11 +89,11 @@ class UserGroupsController(base.BaseCont
def user_group_name(user_group_id, user_group_name):
return template.get_def("user_group_name") \
- .render_unicode(user_group_id, user_group_name, _=_, h=h, c=c)
+ .render_unicode(user_group_id, user_group_name, _=_, webutils=webutils, c=c)
def user_group_actions(user_group_id, user_group_name):
return template.get_def("user_group_actions") \
- .render_unicode(user_group_id, user_group_name, _=_, h=h, c=c)
+ .render_unicode(user_group_id, user_group_name, _=_, webutils=webutils, c=c)
for user_gr in group_iter:
user_groups_data.append({
diff --git a/kallithea/controllers/admin/users.py b/kallithea/controllers/admin/users.py
--- a/kallithea/controllers/admin/users.py
+++ b/kallithea/controllers/admin/users.py
@@ -75,11 +75,11 @@ class UsersController(base.BaseControlle
def username(user_id, username):
return template.get_def("user_name") \
- .render_unicode(user_id, username, _=_, h=h, c=c)
+ .render_unicode(user_id, username, _=_, webutils=webutils, c=c)
def user_actions(user_id, username):
return template.get_def("user_actions") \
- .render_unicode(user_id, username, _=_, h=h, c=c)
+ .render_unicode(user_id, username, _=_, webutils=webutils, c=c)
for user in c.users_list:
users_data.append({
diff --git a/kallithea/model/notification.py b/kallithea/model/notification.py
--- a/kallithea/model/notification.py
+++ b/kallithea/model/notification.py
@@ -199,13 +199,11 @@ 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)
# translator and helpers inject
_kwargs = {'_': _,
- 'h': h,
+ 'webutils': webutils,
'c': c}
_kwargs.update(kwargs)
if content_type == 'html':
diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py
--- a/kallithea/model/repo.py
+++ b/kallithea/model/repo.py
@@ -95,14 +95,17 @@ 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')
tmpl = template.get_def(tmpl)
- kwargs.update(dict(_=_, h=h, c=c, request=request))
- return tmpl.render_unicode(*args, **kwargs)
+ return tmpl.render_unicode(
+ *args,
+ _=_,
+ webutils=webutils,
+ c=c,
+ request=request,
+ **kwargs)
def get_repos_as_dict(self, repos_list, repo_groups_list=None,
admin=False,
diff --git a/kallithea/templates/data_table/_dt_elements.html b/kallithea/templates/data_table/_dt_elements.html
--- a/kallithea/templates/data_table/_dt_elements.html
+++ b/kallithea/templates/data_table/_dt_elements.html
@@ -14,7 +14,7 @@
%>
${base.repolabel(rtype)}
-
+
${get_name(name)}
%if private and c.visual.show_private_icon:
@@ -23,7 +23,7 @@
%endif
%if fork_of:
-
+
%endif
%if rstate == 'repo_state_pending':
@@ -38,12 +38,12 @@
%def>
<%def name="last_change(last_change)">
-
${h.age(last_change)}
+
${webutils.age(last_change)}
%def>
<%def name="revision(name,rev,tip,author,last_msg)">
%if rev >= 0:
-
${'r%s:%s' % (rev,h.short_id(tip))}
+
${'r%s:%s' % (rev,webutils.short_id(tip))}
%else:
${_('No changesets yet')}
%endif
@@ -51,30 +51,30 @@
<%def name="rss(name)">
%if request.authuser.username != 'default':
-
+
%else:
-
+
%endif
%def>
<%def name="atom(name)">
%if request.authuser.username != 'default':
-
+
%else:
-
+
%endif
%def>
<%def name="repo_actions(repo_name)">
-
+
${_('Edit')}
- ${h.form(h.url('delete_repo', repo_name=repo_name))}
+ ${webutils.form(webutils.url('delete_repo', repo_name=repo_name))}
- ${h.end_form()}
+ ${webutils.end_form()}
%def>
<%def name="repo_state(repo_state)">
@@ -88,62 +88,62 @@
%def>
<%def name="user_actions(user_id, username)">
-
+
${_('Edit')}
- ${h.form(h.url('delete_user', id=user_id))}
+ ${webutils.form(webutils.url('delete_user', id=user_id))}
- ${h.end_form()}
+ ${webutils.end_form()}
%def>
<%def name="user_group_actions(user_group_id, user_group_name)">
-
+
${_('Edit')}
- ${h.form(h.url('delete_users_group', id=user_group_id))}
+ ${webutils.form(webutils.url('delete_users_group', id=user_group_id))}
- ${h.end_form()}
+ ${webutils.end_form()}
%def>
<%def name="group_name_html(group_name,name)">
%def>
<%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
-
+
${_('Edit')}
- ${h.form(h.url('delete_repo_group', group_name=repo_group_name))}
+ ${webutils.form(webutils.url('delete_repo_group', group_name=repo_group_name))}
- ${h.end_form()}
+ ${webutils.end_form()}
%def>
<%def name="user_name(user_id, username)">
- ${h.link_to(username,h.url('edit_user', id=user_id))}
+ ${webutils.link_to(username,webutils.url('edit_user', id=user_id))}
%def>
<%def name="repo_group_name(repo_group_name, children_groups)">
%def>
<%def name="user_group_name(user_group_id, user_group_name)">
%def>
diff --git a/kallithea/templates/email/changeset_comment.html b/kallithea/templates/email/changeset_comment.html
--- a/kallithea/templates/email/changeset_comment.html
+++ b/kallithea/templates/email/changeset_comment.html
@@ -1,7 +1,7 @@
<%inherit file="main.html"/>\
\
<%block name="header">\
-<% title = _('Mention in Comment on Changeset "%s"') % h.shorter(message, 200, firstline=True) if is_mention else _('Comment on Changeset "%s"') % h.shorter(message, 200, firstline=True) %>\
+<% title = _('Mention in Comment on Changeset "%s"') % webutils.shorter(message, 200, firstline=True) if is_mention else _('Comment on Changeset "%s"') % webutils.shorter(message, 200, firstline=True) %>\
<%include file="header.html" args="title=title,link=cs_comment_url"/>\
%block>\
\
@@ -25,7 +25,7 @@
diff --git a/kallithea/templates/email/changeset_comment.txt b/kallithea/templates/email/changeset_comment.txt
--- a/kallithea/templates/email/changeset_comment.txt
+++ b/kallithea/templates/email/changeset_comment.txt
@@ -1,5 +1,5 @@
<%block name="header">\
-<% title = _('Mention in Comment on Changeset "%s"') % h.shorter(message, 200, firstline=True) if is_mention else _('Comment on Changeset "%s"') % h.shorter(message, 200, firstline=True) %>\
+<% title = _('Mention in Comment on Changeset "%s"') % webutils.shorter(message, 200, firstline=True) if is_mention else _('Comment on Changeset "%s"') % webutils.shorter(message, 200, firstline=True) %>\
<%include file="header.txt" args="title=title,link=cs_comment_url"/>\
%block>\
@@ -9,7 +9,7 @@ ${_('Changeset on')|n,unicode} \
${cs_target_repo|n,unicode} \
${_('branch')|n,unicode} \
${branch|n,unicode}:
-"${h.shorter(message, 60, firstline=True)|n,unicode}" \
+"${webutils.shorter(message, 60, firstline=True)|n,unicode}" \
${_('by')|n,unicode} \
${cs_author.full_name_and_username|n,unicode}.
diff --git a/kallithea/templates/email/pull_request.html b/kallithea/templates/email/pull_request.html
--- a/kallithea/templates/email/pull_request.html
+++ b/kallithea/templates/email/pull_request.html
@@ -72,8 +72,8 @@
%for revision, desc in pr_revisions:
- ${h.shorter(desc, 80, firstline=True)}
+ href="${webutils.canonical_url('changeset_home', repo_name=org_repo_name, revision=revision)}">
+ ${webutils.shorter(desc, 80, firstline=True)}
%endfor
diff --git a/kallithea/templates/email/pull_request.txt b/kallithea/templates/email/pull_request.txt
--- a/kallithea/templates/email/pull_request.txt
+++ b/kallithea/templates/email/pull_request.txt
@@ -26,7 +26,7 @@ ${body|n,unicode}
${_('Changesets')|n,unicode}:
%for revision, desc in pr_revisions:
-${h.shorter(desc, 80, firstline=True)|n,unicode}
+${webutils.shorter(desc, 80, firstline=True)|n,unicode}
%endfor
<% title = _('View Pull Request') %>\
diff --git a/kallithea/tests/models/test_notifications.py b/kallithea/tests/models/test_notifications.py
--- a/kallithea/tests/models/test_notifications.py
+++ b/kallithea/tests/models/test_notifications.py
@@ -5,8 +5,8 @@ import mock
from tg.util.webtest import test_context
import kallithea.lib.celerylib
-import kallithea.lib.helpers as h
import kallithea.model.async_tasks
+from kallithea.lib import webutils
from kallithea.model import db, meta
from kallithea.model.notification import EmailNotificationModel, NotificationModel
from kallithea.model.user import UserModel
@@ -53,7 +53,7 @@ class TestNotifications(base.TestControl
body='hi there',
recipients=usrs)
- @mock.patch.object(h, 'canonical_url', (lambda arg, **kwargs: 'http://%s/?%s' % (arg, '&'.join('%s=%s' % (k, v) for (k, v) in sorted(kwargs.items())))))
+ @mock.patch.object(webutils, 'canonical_url', (lambda arg, **kwargs: 'http://%s/?%s' % (arg, '&'.join('%s=%s' % (k, v) for (k, v) in sorted(kwargs.items())))))
def test_dump_html_mails(self):
# Exercise all notification types and dump them to one big html file
l = []
diff --git a/scripts/deps.py b/scripts/deps.py
--- a/scripts/deps.py
+++ b/scripts/deps.py
@@ -164,7 +164,6 @@ known_violations = [
('kallithea.model.async_tasks', 'kallithea.model'),
('kallithea.model', 'kallithea.lib.auth'), # auth.HasXXX
('kallithea.model', 'kallithea.lib.auth_modules'), # validators
-('kallithea.model', 'kallithea.lib.helpers'),
('kallithea.model', 'kallithea.lib.hooks'), # clean up hooks
('kallithea.model', 'kallithea.model.scm'),
('kallithea.model.scm', 'kallithea.lib.hooks'),