##// END OF EJS Templates
notifications: don't rely on template context variable in notification model.
marcink -
r1319:6ba85770 default
parent child Browse files
Show More
@@ -27,7 +27,6 b' Model for notifications'
27 import logging
27 import logging
28 import traceback
28 import traceback
29
29
30 from pylons import tmpl_context as c
31 from pylons.i18n.translation import _, ungettext
30 from pylons.i18n.translation import _, ungettext
32 from sqlalchemy.sql.expression import false, true
31 from sqlalchemy.sql.expression import false, true
33 from mako import exceptions
32 from mako import exceptions
@@ -318,6 +317,7 b' class EmailNotificationModel(BaseModel):'
318
317
319 """
318 """
320 super(EmailNotificationModel, self).__init__()
319 super(EmailNotificationModel, self).__init__()
320 self.rhodecode_instance_name = None
321
321
322 def _update_kwargs_for_render(self, kwargs):
322 def _update_kwargs_for_render(self, kwargs):
323 """
323 """
@@ -326,9 +326,18 b' class EmailNotificationModel(BaseModel):'
326 :param kwargs:
326 :param kwargs:
327 :return:
327 :return:
328 """
328 """
329 rhodecode_name = self.rhodecode_instance_name
330 if not rhodecode_name:
331 try:
332 rc_config = SettingsModel().get_all_settings()
333 except Exception:
334 log.exception('failed to fetch settings')
335 rc_config = {}
336 rhodecode_name = rc_config.get('rhodecode_title', '')
337 kwargs['rhodecode_instance_name'] = rhodecode_name
338
329 _kwargs = {
339 _kwargs = {
330 'instance_url': h.url('home', qualified=True),
340 'instance_url': h.url('home', qualified=True),
331 'rhodecode_instance_name': getattr(c, 'rhodecode_name', '')
332 }
341 }
333 _kwargs.update(kwargs)
342 _kwargs.update(kwargs)
334 return _kwargs
343 return _kwargs
General Comments 0
You need to be logged in to leave comments. Login now