comparison rhodecode/model/notification.py @ 3654:ec6354949623 beta

Fix a lot of casings - use standard casing in most places
author Mads Kiilerich <madski@unity3d.com>
date Wed, 03 Apr 2013 17:19:47 +0200
parents 260a7a01b054
children 40d50bb7cf2f
comparison
equal deleted inserted replaced
3653:4c78a0855a17 3654:ec6354949623
219 of notification object 219 of notification object
220 """ 220 """
221 #alias 221 #alias
222 _n = notification 222 _n = notification
223 _map = { 223 _map = {
224 _n.TYPE_CHANGESET_COMMENT: _('commented on changeset at %(when)s'), 224 _n.TYPE_CHANGESET_COMMENT: _('%(user)s commented on changeset at %(when)s'),
225 _n.TYPE_MESSAGE: _('sent message at %(when)s'), 225 _n.TYPE_MESSAGE: _('%(user)s sent message at %(when)s'),
226 _n.TYPE_MENTION: _('mentioned you at %(when)s'), 226 _n.TYPE_MENTION: _('%(user)s mentioned you at %(when)s'),
227 _n.TYPE_REGISTRATION: _('registered in RhodeCode at %(when)s'), 227 _n.TYPE_REGISTRATION: _('%(user)s registered in RhodeCode at %(when)s'),
228 _n.TYPE_PULL_REQUEST: _('opened new pull request at %(when)s'), 228 _n.TYPE_PULL_REQUEST: _('%(user)s opened new pull request at %(when)s'),
229 _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request at %(when)s') 229 _n.TYPE_PULL_REQUEST_COMMENT: _('%(user)s commented on pull request at %(when)s')
230 } 230 }
231 231 tmpl = _map[notification.type_]
232 # action == _map string 232
233 tmpl = "%(user)s %(action)s "
234 if show_age: 233 if show_age:
235 when = h.age(notification.created_on) 234 when = h.age(notification.created_on)
236 else: 235 else:
237 when = h.fmt_date(notification.created_on) 236 when = h.fmt_date(notification.created_on)
238 237
239 data = dict( 238 return tmpl % dict(
240 user=notification.created_by_user.username, 239 user=notification.created_by_user.username,
241 action=_map[notification.type_] % {'when': when}, 240 when=when,
242 ) 241 )
243 return tmpl % data
244 242
245 243
246 class EmailNotificationModel(BaseModel): 244 class EmailNotificationModel(BaseModel):
247 245
248 TYPE_CHANGESET_COMMENT = Notification.TYPE_CHANGESET_COMMENT 246 TYPE_CHANGESET_COMMENT = Notification.TYPE_CHANGESET_COMMENT