Session

Todo

Docstrings (module, models, operations, utilities)

Models

class indico.modules.events.sessions.models.sessions.Session(**kwargs)

Bases: indico.core.db.sqlalchemy.descriptions.DescriptionMixin, indico.core.db.sqlalchemy.colors.ColorMixin, indico.core.db.sqlalchemy.protection.ProtectionManagersMixin, indico.core.db.sqlalchemy.locations.LocationMixin, indico.core.db.sqlalchemy.attachments.AttachedItemsMixin, indico.core.db.sqlalchemy.notes.AttachedNotesMixin, sqlalchemy.orm.decl_api.Model

ATTACHMENT_FOLDER_ID_COLUMN = 'session_id'
PRELOAD_EVENT_ATTACHED_ITEMS = True
PRELOAD_EVENT_NOTES = True
access_key = None
acl_entries
allow_relationship_preloading = True
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
conveners
default_colors = ColorTuple(text='202020', background='e3f2d3')
default_contribution_duration
default_render_mode = 2
disallowed_protection_modes = frozenset()
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
is_deleted
is_poster
location_backref_name = 'sessions'
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 passing obj.locator.other to the code expecting an object with a locator.

note
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: 2>}
classmethod preload_acl_entries(event)
protection_mode
protection_parent

The parent object to consult for ProtectionMode.inheriting.

render_mode = 2
session

Convenience property so all event entities have it.

start_dt
text_color
title
type
type_id
class indico.modules.events.sessions.models.blocks.SessionBlock(**kwargs)

Bases: indico.core.db.sqlalchemy.locations.LocationMixin, sqlalchemy.orm.decl_api.Model

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
event
full_title
has_note
id
inherit_location
location_backref_name = 'session_blocks'
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 passing obj.locator.other to the code expecting an object with a locator.

note
own_address
own_room
own_room_id
own_room_name
own_venue
own_venue_id
own_venue_name

Persons associated with this session block

session_id
slug
start_dt
title

Bases: indico.modules.events.models.persons.PersonLinkBase

Association between EventPerson and SessionBlock.

Also known as a ‘session convener’.

display_order
id
object_relationship_name = 'session_block'
person
person_id
session_block_id
class indico.modules.events.sessions.models.principals.SessionPrincipal(**kwargs)

Bases: indico.core.db.sqlalchemy.principals.PrincipalPermissionsMixin, sqlalchemy.orm.decl_api.Model

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
allow_emails = True
allow_event_roles = True
allow_registration_forms = True
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
local_group_id
multipass_group_name
multipass_group_provider
permissions
principal_backref_name = 'in_session_acls'
principal_for = 'Session'
read_access
registration_form
registration_form_id
session_id

The ID of the associated session

type
unique_columns = ('session_id',)
user
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)
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)

Bases: indico.legacy.pdfinterface.base.PDFBase

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_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_session_timetable_pdf(sess, **kwargs)
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