Log

Todo

Docstrings (module, models, utilities)

Models

class indico.modules.events.logs.models.entries.EventLogEntry(**kwargs)

Bases: flask_sqlalchemy.Model

Log entries for events

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

data

Type-specific data

event

The Event this log entry is associated with

event_id

The ID of the event

id

The ID of the log entry

kind

The general kind of operation that was performed

logged_date
logged_dt

The date/time when the reminder was created

module

The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).

realm

The general area of the event the entry comes from

render()

Renders the log entry to be displayed.

If the renderer is not available anymore, e.g. because of a disabled plugin, None is returned.

renderer
summary

A short one-line description of the logged action. Should not be translated!

type

The type of the log entry. This needs to match the name of a log renderer.

user

The user associated with the log entry

user_id

The ID of the user associated with the entry

class indico.modules.events.logs.models.entries.EventLogKind

Bases: int, indico.util.struct.enum.IndicoEnum

change = 3
negative = 4
other = 1
positive = 2
class indico.modules.events.logs.models.entries.EventLogRealm

Bases: indico.util.struct.enum.RichIntEnum

emails = 5
event = 1
management = 2
participants = 3
reviewing = 4

Utilities

indico.modules.events.logs.util.get_log_renderers()
indico.modules.events.logs.util.make_diff_log(changes, fields)

Create a value for log data containing change information.

Parameters:
  • changes – a dict mapping attributes to (old, new) tuples
  • fields – a dict mapping attributes to field metadata. for simple cases this may be a string with the human-friendly title, for more advanced fields it should be a dict containing title, a type string and a convert callback which will be invoked with a tuple containing the old and new value
indico.modules.events.logs.util.render_changes(a, b, type_)

Render the comparison of a and b as HTML.

Parameters:
  • a – old value
  • b – new value
  • type – the type determining how the values should be compared
class indico.modules.events.logs.renderers.EmailRenderer

Bases: indico.modules.events.logs.renderers.EventLogRendererBase

name = u'email'
template_name = u'events/logs/entry_email.html'
class indico.modules.events.logs.renderers.EventLogRendererBase

Bases: object

Base class for event log renderers.

classmethod get_data(entry)

Returns the entry data in a format suitable for the template.

This method may be overridden if the entry’s data needs to be preprocessed before being passed to the template.

It MUST NOT modify entry.data directly.

name = None

unique name of the log renderer (matches EventLogEntry.type)

plugin = None

plugin containing this renderer - assigned automatically

classmethod render_entry(entry)

Renders the log entry row

Parameters:entry – A EventLogEntry
template_kwargs = {}

extra kwargs passed to render_template

template_name = None

template used to render the log entry

class indico.modules.events.logs.renderers.SimpleRenderer

Bases: indico.modules.events.logs.renderers.EventLogRendererBase

classmethod get_data(entry)
name = u'simple'
template_kwargs = {u'compare': <function render_changes>}
template_name = u'events/logs/entry_simple.html'