##// END OF EJS Templates
audit-logs: don't use old style parser for new audit logs.
marcink -
r1834:b6177862 default
parent child Browse files
Show More
@@ -42,8 +42,13 b' def action_parser(user_log, feed=False, '
42 42 :param feed: use output for feeds (no html and fancy icons)
43 43 :param parse_cs: parse Changesets into VCS instances
44 44 """
45 ap = ActionParser(user_log, feed=False, parse_commits=False)
46 return ap.callbacks()
45 if user_log.version == 'v2':
46 ap = AuditLogParser(user_log)
47 return ap.callbacks()
48 else:
49 # old style
50 ap = ActionParser(user_log, feed=False, parse_commits=False)
51 return ap.callbacks()
47 52
48 53
49 54 class ActionParser(object):
@@ -304,6 +309,34 b' class ActionParser(object):'
304 309 return self.user_log.repository is None
305 310
306 311
312 class AuditLogParser(object):
313 def __init__(self, audit_log_entry):
314 self.audit_log_entry = audit_log_entry
315
316 def get_icon(self, action):
317 return 'icon-rhodecode'
318
319 def callbacks(self):
320 action_str = self.audit_log_entry.action
321
322 def callback():
323 # returned callbacks we need to call to get
324 action = action_str \
325 .replace('[', '<span class="journal_highlight">')\
326 .replace(']', '</span>')
327 return literal(action)
328
329 def icon():
330 tmpl = """<i class="%s" alt="%s"></i>"""
331 ico = self.get_icon(action_str)
332 return literal(tmpl % (ico, action_str))
333
334 action_params_func = _no_params_func
335
336 return [
337 callback, action_params_func, icon]
338
339
307 340 def _no_params_func():
308 341 return ""
309 342
General Comments 0
You need to be logged in to leave comments. Login now