Mercurial > kallithea
diff rhodecode/model/notification.py @ 2082:0e27da019f84 beta
code garden
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 01 Mar 2012 02:52:46 +0200 |
parents | 179604334d98 |
children | 8ecfed1d8f8b |
line wrap: on
line diff
--- a/rhodecode/model/notification.py Thu Mar 01 02:45:47 2012 +0200 +++ b/rhodecode/model/notification.py Thu Mar 01 02:52:46 2012 +0200 @@ -169,10 +169,12 @@ of notification object """ - _map = {notification.TYPE_CHANGESET_COMMENT:_('commented on commit'), - notification.TYPE_MESSAGE:_('sent message'), - notification.TYPE_MENTION:_('mentioned you'), - notification.TYPE_REGISTRATION:_('registered in RhodeCode')} + _map = { + notification.TYPE_CHANGESET_COMMENT: _('commented on commit'), + notification.TYPE_MESSAGE: _('sent message'), + notification.TYPE_MENTION: _('mentioned you'), + notification.TYPE_REGISTRATION: _('registered in RhodeCode') + } DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S" @@ -182,9 +184,10 @@ else: DTF = lambda d: datetime.datetime.strftime(d, DATETIME_FORMAT) when = DTF(notification.created_on) - data = dict(user=notification.created_by_user.username, - action=_map[notification.type_], - when=when) + data = dict( + user=notification.created_by_user.username, + action=_map[notification.type_], when=when, + ) return tmpl % data @@ -200,10 +203,10 @@ self._tmpl_lookup = rhodecode.CONFIG['pylons.app_globals'].mako_lookup self.email_types = { - self.TYPE_CHANGESET_COMMENT:'email_templates/changeset_comment.html', - self.TYPE_PASSWORD_RESET:'email_templates/password_reset.html', - self.TYPE_REGISTRATION:'email_templates/registration.html', - self.TYPE_DEFAULT:'email_templates/default.html' + self.TYPE_CHANGESET_COMMENT: 'email_templates/changeset_comment.html', + self.TYPE_PASSWORD_RESET: 'email_templates/password_reset.html', + self.TYPE_REGISTRATION: 'email_templates/registration.html', + self.TYPE_DEFAULT: 'email_templates/default.html' } def get_email_tmpl(self, type_, **kwargs): @@ -216,7 +219,7 @@ base = self.email_types.get(type_, self.email_types[self.TYPE_DEFAULT]) email_template = self._tmpl_lookup.get_template(base) # translator inject - _kwargs = {'_':_} + _kwargs = {'_': _} _kwargs.update(kwargs) log.debug('rendering tmpl %s with kwargs %s' % (base, _kwargs)) return email_template.render(**_kwargs)