Session
Todo
Docstrings (module, models, operations, utilities)
Models
- class indico.modules.events.sessions.models.sessions.Session(**kwargs)
- ATTACHMENT_FOLDER_ID_COLUMN = 'session_id'
The name of the AttachmentFolder column pointing to to the object’s ID
- PRELOAD_EVENT_ATTACHED_ITEMS = True
When set to
True
will preload all items that exist for the same event. Should be set to False when not applicable (no object.event[_new] property).
- PRELOAD_EVENT_NOTES = True
- access_key = None
- acl_entries
- allow_relationship_preloading = True
Whether relationship preloading is allowed. If disabled, the on-load event that populates relationship from the preload cache is not registered.
- background_color
- blocks
- can_manage_blocks(user, allow_admin=True)
Check whether a user can manage session blocks.
This only applies to the blocks themselves, not to contributions inside them.
- can_manage_contributions(user, allow_admin=True)
Check whether a user can manage contributions within the session.
- code
- property conveners
- default_colors = ('202020', 'e3f2d3')
The default colors when not specifying anything.
- default_contribution_duration
- default_render_mode = 2
- disallowed_protection_modes = frozenset({})
The protection modes that are not allowed. Can be overridden in the model that is using the mixin. Affects the table structure, so any changes to it should go along with a migration step! By default, the public mode is disallowed since it does not make much sense in most cases to make something public even though its parent object is private (or inheriting).
- property end_dt
- event
- event_id
- friendly_id
The human-friendly ID for the session
- get_non_inheriting_objects()
Get a set of child objects that do not inherit protection.
- id
- inherit_location
- inheriting_have_acl = True
Whether objects with inheriting protection may have their own ACL entries (which will grant access even if the user cannot access the parent object).
- is_deleted
- property is_poster
- location_backref_name = 'sessions'
The name of the backref added to the Room model for items which are associated with that room.
- property location_parent
The parent object to consult if the location is inherited.
- locator
Define a smart locator property.
This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.
This decorator should usually be applied to a method named
locator
as this name is required for get_locator to find it automatically when just passing the object.If you need more than one locator, you can define it like this:
@locator_property def locator(self): return {...} @locator.other def locator(self): return {...}
The
other
locator can then be accessed by passingobj.locator.other
to the code expecting an object with a locator.
- own_address
- own_no_access_contact = None
- own_room
- own_room_id
- own_room_name
- own_venue
- own_venue_id
- own_venue_name
- possible_render_modes = {RenderMode.markdown}
- classmethod preload_acl_entries(event)
- protection_mode
- property protection_parent
The parent object to consult for ProtectionMode.inheriting.
- render_mode = 2
- property session
Convenience property so all event entities have it.
- speakers_can_access = None
- property start_dt
- text_color
- title
- type
- type_id
- class indico.modules.events.sessions.models.blocks.SessionBlock(**kwargs)
- allow_relationship_preloading = True
Whether relationship preloading is allowed. If disabled, the on-load event that populates relationship from the preload cache is not registered.
- can_access(user, allow_admin=True)
- can_edit_note(user)
- can_manage(user, allow_admin=True)
- can_manage_attachments(user)
- code
- contribution_count
- duration
- end_dt
- property event
- property full_title
- get_manage_button_options(*, note_may_exist=False)
- property has_note
- id
- inherit_location
- location_backref_name = 'session_blocks'
The name of the backref added to the Room model for items which are associated with that room.
- property location_parent
The parent object to consult if the location is inherited.
- locator
Define a smart locator property.
This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.
This decorator should usually be applied to a method named
locator
as this name is required for get_locator to find it automatically when just passing the object.If you need more than one locator, you can define it like this:
@locator_property def locator(self): return {...} @locator.other def locator(self): return {...}
The
other
locator can then be accessed by passingobj.locator.other
to the code expecting an object with a locator.
- log(*args, **kwargs)
Log with prefilled metadata for the session block.
- property note
- own_address
- own_room
- own_room_id
- own_room_name
- own_venue
- own_venue_id
- own_venue_name
- person_links
Persons associated with this session block
- session_id
- property slug
- start_dt
- title
- property url
- class indico.modules.events.sessions.models.persons.SessionBlockPersonLink(*args, **kwargs)
Association between EventPerson and SessionBlock.
Also known as a ‘session convener’.
- display_order
- id
- object_relationship_name = 'session_block'
The name of the relationship pointing to the object the person is linked to
- person
- person_id
- person_link_backref_name = 'session_block_links'
The name of the backref on the EventPerson
- person_link_unique_columns = ('session_block_id',)
The columns which should be included in the unique constraint.
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- session_block_id
- class indico.modules.events.sessions.models.principals.SessionPrincipal(**kwargs)
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.
- allow_category_roles = True
Whether it should be allowed to add a category role
- allow_emails = True
Whether it should be allowed to add a user by email address. This is useful in places where no Indico user exists yet. Usually adding an email address to an ACL should result in an email being sent to the user, inviting him to create an account with that email address.
- allow_event_roles = True
Whether it should be allowed to add an event role.
- allow_registration_forms = True
Whether it should be allowed to add registrants
- category_role
- category_role_id
- disallowed_protection_modes = frozenset({})
- email
- event_role
- event_role_id
- full_access
- id
The ID of the acl entry
- ip_network_group = None
- ip_network_group_id = None
- local_group_id
- multipass_group_name
- multipass_group_provider
- permissions
- principal_backref_name = 'in_session_acls'
The name of the backref added to User and LocalGroup. For consistency, it is recommended to name the backref
in_foo_acl
with foo describing the ACL where this mixin is used.
- principal_for = 'Session'
The model for which we are a principal. May also be a string containing the model’s class name.
- read_access
- registration_form
- registration_form_id
- session_id
The ID of the associated session
- type
- unique_columns = ('session_id',)
The columns which should be included in the unique constraints. If set to
None
, no unique constraints will be added.
- user_id
Operations
- indico.modules.events.sessions.operations.create_session(event, data)
Create a new session with the information passed in the data argument.
- indico.modules.events.sessions.operations.create_session_block(session_, data)
- indico.modules.events.sessions.operations.delete_session(event_session)
Delete session from the event.
- indico.modules.events.sessions.operations.delete_session_block(session_block, *, delete_empty_session=True, log=True)
- indico.modules.events.sessions.operations.update_session(event_session, data)
Update a session based on the information in the data.
- indico.modules.events.sessions.operations.update_session_block(session_block, data)
Update a session block with data passed in the data argument.
- indico.modules.events.sessions.operations.update_session_coordinator_privs(event, data)
Utilities
- class indico.modules.events.sessions.util.SessionListToPDF(sessions)
- getBody(story=None)
Add the content to the story.
- indico.modules.events.sessions.util.can_manage_sessions(user, event, permission=None)
Check whether a user can manage any sessions in an event.
- indico.modules.events.sessions.util.generate_pdf_from_sessions(sessions)
Generate a PDF file from a given session list.
- indico.modules.events.sessions.util.generate_session_pdf_timetable(sess)
- indico.modules.events.sessions.util.generate_spreadsheet_from_sessions(sessions)
Generate spreadsheet data from a given session list.
- Parameters:
sessions – The sessions to include in the spreadsheet
- indico.modules.events.sessions.util.get_events_with_linked_sessions(user, dt=None)
Return a dict with keys representing event_id and the values containing data about the user rights for sessions within the event.
- Parameters:
user – A User
dt – Only include events taking place on/after that date
- indico.modules.events.sessions.util.get_sessions_for_user(event, user)
- indico.modules.events.sessions.util.has_sessions_for_user(event, user)
- indico.modules.events.sessions.util.render_session_type_row(session_type)
- indico.modules.events.sessions.util.session_coordinator_priv_enabled(event, priv)
Check whether a coordinator privilege is enabled.
Currently the following privileges are available:
manage-contributions
manage-blocks
- Parameters:
event – The Event to check for
priv – The name of the privilege