##// 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,6 +42,11 b' def action_parser(user_log, feed=False, '
42 :param feed: use output for feeds (no html and fancy icons)
42 :param feed: use output for feeds (no html and fancy icons)
43 :param parse_cs: parse Changesets into VCS instances
43 :param parse_cs: parse Changesets into VCS instances
44 """
44 """
45 if user_log.version == 'v2':
46 ap = AuditLogParser(user_log)
47 return ap.callbacks()
48 else:
49 # old style
45 ap = ActionParser(user_log, feed=False, parse_commits=False)
50 ap = ActionParser(user_log, feed=False, parse_commits=False)
46 return ap.callbacks()
51 return ap.callbacks()
47
52
@@ -304,6 +309,34 b' class ActionParser(object):'
304 return self.user_log.repository is None
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 def _no_params_func():
340 def _no_params_func():
308 return ""
341 return ""
309
342
General Comments 0
You need to be logged in to leave comments. Login now