Hooking into Indico using Signals

Signals allow you to hook into certain parts of Indico without adding any code to the core (which is something a plugin can and should not do). Each signal has a sender which can be any object (depending on the signal) and possibly some keyword arguments. Some signals also make use of their return value or even require one. Check the documentation of each signal on how it’s used.

To avoid breakage with newer versions of Indico, it is highly advised to always accept extra **kwargs in your signal receiver. For example, a receiver function could look like this:

def receiver(sender, something, **kwargs):
    do_stuff_with(something)

indico.core.signals

indico.core.signals.add_form_fields

Lets you add extra fields to a form. The sender is the form class and should always be specified when subscribing to this signal.

The signal handler should return one or more 'name', Field tuples. Each field will be added to the form as ext__<name> and is automatically excluded from the form’s data property and its populate_obj method.

To actually process the data, you can use e.g. the form_validated signal and then store it in flask.g until another signal informs you that the operation the user was performing has been successful.

indico.core.signals.after_process

Called after an Indico request has been processed.

indico.core.signals.app_created

Called when the app has been created. The sender is the flask app.

indico.core.signals.db_schema_created

Executed when a new database schema is created. The sender is the name of the schema.

indico.core.signals.form_validated

Triggered when an IndicoForm was validated successfully. The sender is the form object.

This signal may return False to mark the form as invalid even though WTForms validation was successful. In this case it is highly recommended to mark a field as erroneous or indicate the error in some other way.

indico.core.signals.get_conditions

Expected to return one or more classes inheriting from Condition. The sender is a string (or some other object) identifying the context. The additional kwargs passed to this signal depend on the context.

indico.core.signals.get_fields

Expected to return BaseField subclasses. The sender is an object (or just a string) identifying for what to get fields. This signal should never be registered without restricting the sender to ensure only the correct field types are returned.

indico.core.signals.get_placeholders

Expected to return one or more Placeholder objects. The sender is a string (or some other object) identifying the context. The additional kwargs passed to this signal depend on the context.

indico.core.signals.get_storage_backends

Expected to return one or more Storage subclasses.

indico.core.signals.import_tasks

Called when Celery needs to import all tasks. Use this signal if you have modules containing task registered using one of the Celery decorators but don’t import them anywhere. The signal handler should only import these modules and do nothing else.

indico.core.signals.model_committed

Triggered when an IndicoModel class was committed. The sender is the model class, the model instance is passed as obj and the change type as a string (delete/insert/update) in the change kwarg.

indico.core.signals.acl

indico.core.signals.acl.can_access

Called when ProtectionMixin.can_access is used to determine if a user can access something or not.

The sender is the type of the object that’s using the mixin. The actual instance is passed as obj. The user and allow_admin arguments of can_access are passed as kwargs with the same name.

The authorized argument is None when this signal is called at the beginning of the access check and True or False at the end when regular access rights have already been checked. For expensive checks (such as anything involving database queries) it is recommended to skip the check while authorized is None since the regular access check is likely to be cheaper (due to ACLs being preloaded etc).

If the signal returns True or False, the access check succeeds or fails immediately. If multiple subscribers to the signal return contradictory results, False wins and access is denied.

indico.core.signals.acl.can_manage

Called when ProtectionMixin.can_manage is used to determine if a user can manage something or not.

The sender is the type of the object that’s using the mixin. The actual instance is passed as obj. The user, role, allow_admin, check_parent and explicit_role arguments of can_manage are passed as kwargs with the same name.

If the signal returns True or False, the access check succeeds or fails without any further checks. If multiple subscribers to the signal return contradictory results, False wins and access is denied.

indico.core.signals.acl.entry_changed

Called when an ACL entry is changed.

The sender is the type of the object that’s using the mixin. The actual instance is passed as obj. The User, GroupProxy or EmailPrincipal is passed as principal and entry contains the actual ACL entry (a PrincipalMixin instance) or None in case the entry was deleted. is_new is a boolean indicating whether the given principal was in the ACL before. If quiet is True, signal handlers should not perform noisy actions such as logging or sending emails related to the change.

If the ACL uses roles, old_data will contain a dictionary of the previous roles/permissions (see PrincipalRolesMixin.current_data).

indico.core.signals.acl.get_management_roles

Expected to return ManagementRole subclasses. The sender is the type of the object the roles may be used for. Functions subscribing to this signal MUST check the sender by specifying it using the first argument of connect_via() or by comparing it inside the function.

indico.core.signals.acl.protection_changed

Called when the protection mode of an object is changed.

The sender is the type of the object that’s using the mixin. The actual instance is passed as obj. The old protection mode is passed as old_mode, the new mode as mode.

indico.core.signals.agreements

indico.core.signals.agreements.get_definitions

Expected to return a list of AgreementDefinition classes.

indico.core.signals.attachments

indico.core.signals.attachments.attachment_accessed

Called when an attachment is accessed. The sender is the Attachment that was accessed. The user who accessed the attachment is passed in the user kwarg. The from_preview kwarg will be set to True if the download link on the preview page was used to access the attachment or if the attachment was loaded to be displayed on the preview page (opening the preview itself already sends this signal with from_preview=False).

indico.core.signals.attachments.attachment_created

Called when a new attachment is created. The sender object is the new Attachment. The user who created the attachment is passed in the user kwarg.

indico.core.signals.attachments.attachment_deleted

Called when an attachment is deleted. The sender object is the Attachment that was deleted. The user who deleted the attachment is passed in the user kwarg.

indico.core.signals.attachments.attachment_updated

Called when an attachment is updated. The sender is the Attachment that was updated. The user who updated the attachment is passed in the user kwarg.

indico.core.signals.attachments.folder_created

Called when a new attachment folder is created. The sender is the new AttachmentFolder object. The user who created the folder is passed in the user kwarg. This signal is never triggered for the internal default folder.

indico.core.signals.attachments.folder_deleted

Called when a folder is deleted. The sender is the AttachmentFolder that was deleted. The user who deleted the folder is passed in the user kwarg.

indico.core.signals.attachments.folder_updated

Called when a folder is updated. The sender is the AttachmentFolder that was updated. The user who updated the folder is passed in the user kwarg.

indico.core.signals.attachments.get_file_previewers

Expected to return one or more Previewer subclasses.

indico.core.signals.category

indico.core.signals.category.created

Called when a new category is created. The sender is the new category.

indico.core.signals.category.deleted

Called when a category is deleted. The sender is the category.

indico.core.signals.category.moved

Called when a category is moved into another category. The sender is the category and the old parent category is passed in the old_parent kwarg.

indico.core.signals.category.updated

Called when a new category is created. The sender is the new category.

indico.core.signals.event

indico.core.signals.event.abstract_created

Called when a new abstract is created. The sender is the new abstract.

indico.core.signals.event.abstract_deleted

Called when an abstract is deleted. The sender is the abstract.

indico.core.signals.event.abstract_state_changed

Called when an abstract is withdrawn. The sender is the abstract.

indico.core.signals.event.abstract_updated

Called when an abstract is modified. The sender is the abstract.

indico.core.signals.event.cloned

Called when an event is cloned. The sender is the Event object of the old event, the new event is passed in the new_event kwarg.

indico.core.signals.event.contribution_created

Called when a new contribution is created. The sender is the new contribution.

indico.core.signals.event.contribution_deleted

Called when a contribution is deleted. The sender is the contribution.

indico.core.signals.event.contribution_updated

Called when a contribution is modified. The sender is the contribution. A dict containing old, new tuples for all changed values is passed in the changes kwarg.

indico.core.signals.event.created

Called when a new event is created. The sender is the new Event.

indico.core.signals.event.deleted

Called when an event is deleted. The sender is the event object. The user kwarg contains the user performing the deletion if available.

indico.core.signals.event.get_feature_definitions

Expected to return EventFeature subclasses.

indico.core.signals.event.get_log_renderers

Expected to return EventLogRenderer classes.

indico.core.signals.event.has_read_access

Called when resolving the read access permissions for an event. The sender is the event, and the following parameters are available:

  • user - the user that is trying to access the event (User or None)

Should return True or False.

indico.core.signals.event.moved

Called when an event is moved to a different category. The sender is the event, the old category is in the old_parent kwarg.

indico.core.signals.event.note_added

Called when a note is added. The sender is the note.

indico.core.signals.event.note_deleted

Called when a note is deleted. The sender is the note.

indico.core.signals.event.note_modified

Called when a note is modified. The sender is the note.

indico.core.signals.event.person_updated

Called when an EventPerson is modified. The sender is the EventPerson.

indico.core.signals.event.registration_deleted

Called when a registration is removed. The sender is the registration.

indico.core.signals.event.registration_form_created

Called when a new registration form is created. The sender is the RegistrationForm object.

indico.core.signals.event.registration_state_updated

Called when the state of registration changes. The sender is the registration; the previous state is passed in the previous_state kwarg.

indico.core.signals.event.session_block_deleted

Called when a session block is deleted. The sender is the session block. This signal is called before the db.session.delete() on the block is executed.

indico.core.signals.event.session_deleted

Called when a session is deleted. The sender is the session.

indico.core.signals.event.session_updated

Called when a session is updated. The sender is the session.

indico.core.signals.event.sidemenu

Expected to return MenuEntryData objects to be added to the event side menu. A single entry can be returned directly, multiple entries must be yielded.

indico.core.signals.event.subcontribution_created

Called when a new subcontribution is created. The sender is the new subcontribution.

indico.core.signals.event.subcontribution_deleted

Called when a subcontribution is deleted. The sender is the subcontribution.

indico.core.signals.event.subcontribution_updated

Called when a subcontribution is modified. The sender is the subcontribution.

indico.core.signals.event.times_changed

Called when the times of a scheduled object (contribution, break or session block) change, either by a change in duration or start time. The sender is the type of the object; the timetable entry is passed as entry and the object is passed as obj. Information about the changes are passed as changes which is a dict containing old/new tuples for start_dt, duration and end_dt. If an attribute did not change, it is not included in the dict. If the time of the event itself changes, entry is None and obj contains the Event.

indico.core.signals.event.timetable_buttons

Expected to return a list of tuples (‘button_name’, ‘js-call-class’). Called when building the timetable view.

indico.core.signals.event.timetable_entry_created

Called when a new timetable entry is created. The sender is the new entry.

indico.core.signals.event.timetable_entry_deleted

Called when a timetable entry is deleted. The sender is the entry. This signal is triggered right before the entry deletion is performed.

indico.core.signals.event.timetable_entry_updated

Called when a timetable entry is updated. The sender is the entry. A dict containing old, new tuples for all changed values is passed in the changes kwarg.

indico.core.signals.event.type_changed

Called when the type of an event is changed. The sender is the event, the old type is passed in the old_type kwarg.

indico.core.signals.event.updated

Called when basic data of an event is updated. The sender is the event. A dict of changes is passed in the changes kwarg, with (old, new) tuples for each change. Note than the person_links change may happen with old and new being the same lists for technical reasons. If the key is present, it should be assumed that something changed (usually the order or some data on the person link).

indico.core.signals.event_management

indico.core.signals.event_management.get_cloners

Expected to return one or more EventCloner subclasses implementing a cloning operation for something within an event.

indico.core.signals.event_management.image_created

Called when a new image is created. The sender object is the new ImageFile. The user who uploaded the image is passed in the user kwarg.

indico.core.signals.event_management.image_deleted

Called when an image is deleted. The sender object is the ImageFile that is about to be deleted. The user who uploaded the image is passed in the user kwarg.

indico.core.signals.event_management.management_url

Expected to return a URL for the event management page of the plugin. This is used when someone who does not have event management access wants to go to the event management area. He is then redirected to one of the URLs returned by plugins, i.e. it is not guaranteed that the user ends up on a specific plugin’s management page. The signal should return None if the current user (available via session.user) cannot access the management area. The sender is the event object.

indico.core.signals.menu

indico.core.signals.menu.items

Expected to return one or more SideMenuItem to be added to the side menu. The sender is an id string identifying the target menu.

indico.core.signals.menu.sections

Expected to return one or more SideMenuSection objects to be added to the side menu. The sender is an id string identifying the target menu.

indico.core.signals.plugin

indico.core.signals.plugin.cli

Expected to return one or more click commands/groups. If they use indico.cli.core.cli_command / indico.cli.core.cli_group they will be automatically executed within a plugin context and run within a Flask app context by default.

indico.core.signals.plugin.get_blueprints

Expected to return one or more IndicoPluginBlueprint-based blueprints which will be registered on the application. The Blueprint must be named either PLUGINNAME or compat_PLUGINNAME.

indico.core.signals.plugin.get_conference_themes

Expected to return (name, css, title) tuples for conference stylesheets. name is the internal name used for the stylesheet which will be stored when the theme is selected in an event. css is the location of the CSS file, relative to the plugin’s static folder. title is the title displayed to the user when selecting the theme.

indico.core.signals.plugin.get_event_request_definitions

Expected to return one or more RequestDefinition subclasses.

indico.core.signals.plugin.get_event_themes_files

Expected to return the path of a themes yaml containing event theme definitions.

indico.core.signals.plugin.inject_css

Expected to return a list of CSS URLs which are loaded after all other CSS. The sender is the WP class of the page.

indico.core.signals.plugin.inject_js

Expected to return a list of JS URLs which are loaded after all other JS. The sender is the WP class of the page.

indico.core.signals.plugin.shell_context

Called after adding stuff to the indico shell context. Receives the add_to_context and add_to_context_multi keyword args with functions which allow you to add custom items to the context.

indico.core.signals.plugin.template_hook

Expected to return a (is_markup, priority, value) tuple. The returned value will be inserted at the location where this signal is triggered; if multiple receivers are connected to the signal, they will be ordered by priority. If is_markup is True, the value will be wrapped in a Markup object which will cause it to be rendered as HTML. The sender is the name of the actual hook. The keyword arguments depend on the hook.

indico.core.signals.users

indico.core.signals.users.email_added

Called when a new email address is added to a user. The sender is the user object and the email address is passed in the email kwarg.

indico.core.signals.users.merged

Called when two users are merged. The sender is the main user while the merged user (i.e. the one being deleted in the merge) is passed via the source kwarg.

indico.core.signals.users.preferences

Expected to return a ExtraUserPreferences subclass which implements extra preferences for the user preference page. The sender is the user for whom the preferences page is being shown which might not be the currently logged-in user!

indico.core.signals.users.registered

Called once a user registers (either locally or joins through a provider). The sender is the new user object. The kwarg from_moderation indicates whether the user went through a moderation process (this also includes users created by an administrator manually) or was created immediately on registration; the identity associated with the registration is passed in the identity kwarg.

indico.core.signals.users.registration_requested

Called when a user requests to register a new indico account, i.e. if moderation is enabled. The sender is the registration request.