[PATCH] turbogears migration: fix broken _tmpl_lookup and _template_root instances

Alessandro Molina alessandro.molina at gmail.com
Tue Feb 16 08:38:04 UTC 2016


Hi Thomas,

I added you to committers for kallithea-tg repository, you should now be
able to freely push the patch yourself.
If anyone else is willing to work on that repository feel free to send me
an email, I'll gladly add you.

Bests,
Alessandro

On Tue, Feb 16, 2016 at 9:33 AM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:

> # HG changeset patch
> # User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
> # Date 1455611489 -3600
> #      Tue Feb 16 09:31:29 2016 +0100
> # Node ID 17d13a1e3d7a9ed4f66ec6eb84b25408dc05370a
> # Parent  34d30390a8a0366f87840a40e91eab797a79ef14
> turbogears migration: fix broken _tmpl_lookup and _template_root instances
>
> A few pylons replacements were missed before, causing e.g. e-mail
> notifications to throw an error.
>
> 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
> @@ -30,7 +30,7 @@ import traceback
>  import formencode
>
>  from formencode import htmlfill
> -from tg import request, tmpl_context as c, config
> +from tg import request, tmpl_context as c, config, app_globals
>  from tg.i18n import ugettext as _
>  from sqlalchemy.sql.expression import func
>  from webob.exc import HTTPFound, HTTPNotFound
> @@ -78,7 +78,7 @@ class UsersController(BaseController):
>
>          users_data = []
>          total_records = len(c.users_list)
> -        _tmpl_lookup = kallithea.CONFIG['pylons.app_globals'].mako_lookup
> +        _tmpl_lookup = app_globals.mako_lookup
>          template =
> _tmpl_lookup.get_template('data_table/_dt_elements.html')
>
>          grav_tmpl = '<div class="gravatar">%s</div>'
> diff --git a/kallithea/model/notification.py
> b/kallithea/model/notification.py
> --- a/kallithea/model/notification.py
> +++ b/kallithea/model/notification.py
> @@ -29,7 +29,7 @@ Original author and date, and relevant c
>  import logging
>  import traceback
>
> -from tg import tmpl_context as c
> +from tg import tmpl_context as c, app_globals
>  from tg.i18n import ugettext as _
>  from sqlalchemy.orm import joinedload, subqueryload
>
> @@ -288,8 +288,8 @@ class EmailNotificationModel(BaseModel):
>
>      def __init__(self):
>          super(EmailNotificationModel, self).__init__()
> -        self._template_root =
> kallithea.CONFIG['pylons.paths']['templates'][0]
> -        self._tmpl_lookup =
> kallithea.CONFIG['pylons.app_globals'].mako_lookup
> +        self._template_root = kallithea.CONFIG['paths']['templates'][0]
> +        self._tmpl_lookup = app_globals.mako_lookup
>          self.email_types = {
>              self.TYPE_CHANGESET_COMMENT: 'changeset_comment',
>              self.TYPE_PASSWORD_RESET: 'password_reset',
> diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py
> --- a/kallithea/model/repo.py
> +++ b/kallithea/model/repo.py
> @@ -163,10 +163,10 @@ class RepoModel(BaseModel):
>      @classmethod
>      def _render_datatable(cls, tmpl, *args, **kwargs):
>          import kallithea
> -        from tg import tmpl_context as c
> +        from tg import tmpl_context as c, app_globals
>          from tg.i18n import ugettext as _
>
> -        _tmpl_lookup = kallithea.CONFIG['pylons.app_globals'].mako_lookup
> +        _tmpl_lookup = app_globals.mako_lookup
>          template =
> _tmpl_lookup.get_template('data_table/_dt_elements.html')
>
>          tmpl = template.get_def(tmpl)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160216/893db524/attachment-0001.html>


More information about the kallithea-general mailing list