# Timetable¶

Todo

Docstring (module, models, operations, utilities)

## Models¶

class indico.modules.events.timetable.models.breaks.Break(**kwargs)

Bases: indico.core.db.sqlalchemy.descriptions.DescriptionMixin, indico.core.db.sqlalchemy.colors.ColorMixin, indico.core.db.sqlalchemy.locations.LocationMixin, sqlalchemy.ext.declarative.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.

background_color
can_access(user)
default_colors = ColorTuple(text=u'202020', background=u'90c0f0')
default_render_mode = 2
duration
end_dt
event
id
inherit_location
location_backref_name = u'breaks'
location_parent
locator

Defines 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.

own_address
own_room
own_room_id
own_room_name
own_venue
own_venue_id
own_venue_name
possible_render_modes = set([<RenderMode.markdown: 2>])
render_mode = 2
start_dt
text_color
title
class indico.modules.events.timetable.models.entries.TimetableEntry(**kwargs)

Bases: sqlalchemy.ext.declarative.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.

break_
break_id
can_view(user)

Checks whether the user will see this entry in the timetable.

children
contribution
contribution_id
duration
end_dt
event
event_id
extend_end_dt(end_dt)
extend_parent(by_start=True, by_end=True)

Extend start/end of parent objects if needed.

No extension if performed for entries crossing a day boundary in the event timezone.

Parameters: by_start – Extend parent by start datetime. by_end – Extend parent by end datetime.
extend_start_dt(start_dt)
id
is_parallel(in_session=False)
locator

Defines 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.

move(start_dt)

Move the entry to start at a different time.

This method automatically moves children of the entry to preserve their start time relative to the parent’s start time.

move_next_to(sibling, position=u'before')
object
parent_id
session_block
session_block_id
session_siblings
siblings
siblings_query
start_dt
type
class indico.modules.events.timetable.models.entries.TimetableEntryType

Bases: indico.util.struct.enum.RichIntEnum

BREAK = 3
CONTRIBUTION = 2
SESSION_BLOCK = 1

## Operations¶

indico.modules.events.timetable.operations.can_swap_entry(entry, direction, in_session=False)
indico.modules.events.timetable.operations.create_break_entry(event, data, session_block=None)
indico.modules.events.timetable.operations.create_session_block_entry(session_, data)
indico.modules.events.timetable.operations.create_timetable_entry(event, data, parent=None, extend_parent=False)
indico.modules.events.timetable.operations.delete_timetable_entry(entry, log=True)
indico.modules.events.timetable.operations.fit_session_block_entry(entry, log=True)
indico.modules.events.timetable.operations.get_sibling_entry(entry, direction, in_session=False)
indico.modules.events.timetable.operations.move_timetable_entry(entry, parent=None, day=None)

Move the entry to another session or top-level timetable

Parameters: entry – TimetableEntry to be moved parent – If specified then the entry will be set as a child of parent day – If specified then the entry will be moved to the top-level timetable on this day
indico.modules.events.timetable.operations.schedule_contribution(contribution, start_dt, session_block=None, extend_parent=False)
indico.modules.events.timetable.operations.swap_timetable_entry(entry, direction, session_=None)

Swap entry with closest gap or non-parallel sibling

indico.modules.events.timetable.operations.update_break_entry(break_, data)
indico.modules.events.timetable.operations.update_timetable_entry(entry, data)
indico.modules.events.timetable.operations.update_timetable_entry_object(entry, data)

Update the object of a timetable entry according to its type

## Utilities¶

indico.modules.events.timetable.util.find_latest_entry_end_dt(obj, day=None)

Get the latest end datetime for timetable entries within the object.

Parameters: obj – The Event or SessionBlock that will be used to look for timetable entries. day – The local event date to look for timetable entries. Applicable only to Event. The end datetime of the timetable entry finishing the latest. None if no entry was found.
indico.modules.events.timetable.util.find_next_start_dt(duration, obj, day=None, force=False)

Find the next most convenient start date fitting a duration within an object.

Parameters: duration – Duration to fit into the event/session-block. obj – The Event or SessionBlock the duration needs to fit into. day – The local event date where to fit the duration in case the object is an event. force – Gives earliest datetime if the duration doesn’t fit. The end datetime of the latest scheduled entry in the object if the duration fits then. It it doesn’t, the latest datetime that fits it. None if the duration cannot fit in the object, earliest datetime if force is True.
indico.modules.events.timetable.util.get_category_timetable(categ_ids, start_dt, end_dt, detail_level=u'event', tz=<UTC>, from_categ=None, grouped=True)

Retrieve time blocks that fall within a specific time interval for a given set of categories.

Parameters: categ_ids – iterable containing list of category IDs start_dt – start of search interval (datetime, expected to be in display timezone) end_dt – end of search interval (datetime in expected to be in display timezone) detail_level – the level of detail of information (event|session|contribution) tz – the timezone information should be displayed in from_categ – Category that will be taken into account to calculate visibility grouped – Whether to group results by start date a dictionary containing timetable information in a structured way. See source code for examples.
indico.modules.events.timetable.util.get_nested_entries(*args, **kwargs)
indico.modules.events.timetable.util.get_session_block_entries(event, day)

Returns a list of event top-level session blocks for the given day

indico.modules.events.timetable.util.get_time_changes_notifications(changes, tzinfo, entry=None)
indico.modules.events.timetable.util.get_timetable_offline_pdf_generator(event)
indico.modules.events.timetable.util.get_top_level_entries(*args, **kwargs)
indico.modules.events.timetable.util.render_entry_info_balloon(entry, editable=False, sess=None, is_session_timetable=False)
indico.modules.events.timetable.util.render_session_timetable(session, timetable_layout=None, management=False)
indico.modules.events.timetable.util.shift_following_entries(entry, shift, session_=None)

Reschedules entries starting after the given entry by the given shift.

class indico.modules.events.timetable.reschedule.RescheduleMode

Bases: unicode, indico.util.struct.enum.RichEnum

duration = u'duration'
none = u'none'
time = u'time'
class indico.modules.events.timetable.reschedule.Rescheduler(event, mode, day, session=None, session_block=None, fit_blocks=False, gap=datetime.timedelta(0))

Bases: object

Compacts the the schedule of an event day by either adjusting start times or durations of timetable entries.

Parameters: event – The event of which the timetable entries should be rescheduled. mode – A RescheduleMode value specifying whether the duration or start time should be adjusted. day – A date specifying the day to reschedule (the day of the timetable entries are determined using the event’s timezone) session – If specified, only blocks of that session will be rescheduled, ignoring any other timetable entries. Cannot be combined with session_block. session_block – If specified, only entries inside that block will be rescheduled. Cannot be combined with session. fit_blocks – Whether session blocks should be resized to exactly fit their contents before the actual rescheduling operation. gap – A timedelta specifying the cap between rescheduled timetable entries.
run`()

Perform the rescheduling