Contribution

Todo

Docstrings (module, models, operations, utilities)

Models

class indico.modules.events.contributions.models.contributions.Contribution(**kwargs)
ATTACHMENT_FOLDER_ID_COLUMN = 'contribution_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
abstract
abstract_id
access_key = None
acl_entries
classmethod allocate_friendly_ids(event, n)

Allocate n Contribution friendly_ids.

This is needed so that we can allocate all IDs in one go. Not doing so could result in DB deadlocks. All operations that create more than one contribution should use this method.

Parameters
  • event – the Event in question

  • n – the number of ids to pre-allocate

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.

property allowed_types_for_editable
board_number
can_edit(user)
can_manage(user, permission=None, allow_admin=True, check_parent=True, explicit_permission=False)

Check if the user can manage the object.

Parameters
  • user – The User to check. May be None if the user is not logged in.

  • allow_admin – If admin users should always have access

  • check_parent – If the parent object should be checked. In this case the permission is ignored; only full management access is inherited to children.

  • explicit_permission – If the specified permission should be checked explicitly instead of short-circuiting the check for Indico admins or managers. When this option is set to True, the values of allow_admin and check_parent are ignored. This also applies if permission is None in which case this argument being set to True is equivalent to allow_admin and check_parent being set to False.

Param

permission: The management permission that is needed for the check to succeed. If not specified, full management privs are required. May be set to the string 'ANY' to check if the user has any management privileges. If the user has full_access privileges, he’s assumed to have all possible permissions.

can_submit_proceedings(user)

Whether the user can submit editables/papers.

code
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).

duration
property duration_display

The displayed duration of the contribution.

This is the duration of the poster session if applicable, otherwise the duration of the contribution itself.

property duration_poster
property enabled_editables

Return all submitted editables with enabled types.

property end_dt
property end_dt_display

The displayed end time of the contribution.

This is the end time of the poster session if applicable, otherwise the end time of the contribution itself.

property end_dt_poster
event
event_id
field_values

Data stored in abstract/contribution fields

friendly_id

The human-friendly ID for the contribution

get_editable(editable_type)

Get the editable of the given type.

get_non_inheriting_objects()

Get a set of child objects that do not inherit protection.

property has_published_editables
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
is_paper_reviewer(user)
is_scheduled
is_user_associated(user, check_abstract=False)
keywords
location_backref_name = 'contributions'

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 passing obj.locator.other to the code expecting an object with a locator.

log(*args, **kwargs)

Log with prefilled metadata for the contribution.

own_address
own_no_access_contact = None
own_room
own_room_id
own_room_name
own_venue
own_venue_id
own_venue_name
property paper
paper_content_reviewers

Paper content reviewers

paper_judges

Paper reviewing judges

paper_layout_reviewers

Paper layout reviewers

pending_paper_files

Paper files not submitted for reviewing

possible_render_modes = {RenderMode.html, RenderMode.markdown}
classmethod preload_acl_entries(event)
protection_mode
property protection_parent

The parent object to consult for ProtectionMode.inheriting.

query: IndicoBaseQuery
references

External references associated with this contribution

render_mode
session
session_block
session_block_id
session_id
property slug
property start_dt
property start_dt_display

The displayed start time of the contribution.

This is the start time of the poster session if applicable, otherwise the start time of the contribution itself.

property start_dt_poster
subcontribution_count
subcontributions
property submitters
title
track
track_id
type
type_id
property verbose_title
class indico.modules.events.contributions.models.contributions.CustomFieldsMixin

Methods to process custom field data.

get_field_value(field_id, raw=False)
set_custom_field(field_id, field_value)
class indico.modules.events.contributions.models.fields.ContributionField(**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.

description
event
event_id
property field
field_data
field_type
property filter_choices
id
is_active
property is_public
is_required
is_user_editable
legacy_id
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.

property mgmt_field
position
query: IndicoBaseQuery
title
visibility
class indico.modules.events.contributions.models.fields.ContributionFieldValue(**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.

contribution_field
contribution_field_backref_name = 'contribution_values'

The name of the backref on the ContributionField

contribution_field_id
contribution_id
data
query: IndicoBaseQuery
class indico.modules.events.contributions.models.fields.ContributionFieldValueBase(**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.

contribution_field = <RelationshipProperty at 0x7fa03cd105c0; no key>
contribution_field_backref_name = None

The name of the backref on the ContributionField

property contribution_field_id
data = Column(None, JSONB(astext_type=Text()), table=None, nullable=False)
property friendly_data
class indico.modules.events.contributions.models.fields.ContributionFieldVisibility(value)

An enumeration.

managers_and_submitters = 2
managers_only = 3
public = 1
class indico.modules.events.contributions.models.persons.AuthorType(value)

An enumeration.

classmethod get_highest(*types)
none = 0
primary = 1
secondary = 2

Association between EventPerson and Contribution.

author_type
contribution_id
display_order
id
property is_author
is_speaker
property is_submitter
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.

object_relationship_name = 'contribution'

The name of the relationship pointing to the object the person is linked to

person
person_id

The name of the backref on the EventPerson

The columns which should be included in the unique constraint.

query: IndicoBaseQuery

Association between EventPerson and SubContribution.

author_type = 0
display_order
id
is_speaker = True
object_relationship_name = 'subcontribution'

The name of the relationship pointing to the object the person is linked to

person
person_id

The name of the backref on the EventPerson

The columns which should be included in the unique constraint.

query: IndicoBaseQuery
subcontribution_id
class indico.modules.events.contributions.models.principals.ContributionPrincipal(**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
contribution_id

The ID of the associated contribution

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_contribution_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 = 'Contribution'

The model for which we are a principal. May also be a string containing the model’s class name.

query: IndicoBaseQuery
read_access
registration_form
registration_form_id
type
unique_columns = ('contribution_id',)

The columns which should be included in the unique constraints. If set to None, no unique constraints will be added.

user_id
class indico.modules.events.contributions.models.references.ContributionReference(**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.

contribution_id
id
query: IndicoBaseQuery
reference_backref_name = 'contribution_references'

The name of the backref on the ReferenceType

reference_type
reference_type_id
value
class indico.modules.events.contributions.models.references.SubContributionReference(**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.

id
query: IndicoBaseQuery
reference_backref_name = 'subcontribution_references'

The name of the backref on the ReferenceType

reference_type
reference_type_id
subcontribution_id
value
class indico.modules.events.contributions.models.subcontributions.SubContribution(**kwargs)
ATTACHMENT_FOLDER_ID_COLUMN = 'subcontribution_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
can_access(user, **kwargs)
can_edit(user)
can_manage(user, permission=None, **kwargs)
code
contribution_id
default_render_mode = 2
duration
property event
friendly_id

The human-friendly ID for the sub-contribution

get_access_list()
get_manager_list(recursive=False, include_groups=True)
id
is_deleted
property is_protected
is_user_associated(user)
property location_parent
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.

Persons associated with this contribution

position
possible_render_modes = {RenderMode.html, RenderMode.markdown}
query: IndicoBaseQuery
references

External references associated with this contribution

render_mode
property room_name
property session

Convenience property so all event entities have it.

property slug
property speakers
property timetable_entry

Convenience property so all event entities have it.

title
property venue_name
class indico.modules.events.contributions.models.types.ContributionType(**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.

description
event
event_id
id
is_private
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.

name
query: IndicoBaseQuery

Operations

indico.modules.events.contributions.operations.create_contribution(event, contrib_data, custom_fields_data=None, session_block=None, extend_parent=False)
indico.modules.events.contributions.operations.create_contribution_from_abstract(abstract, contrib_session=None)
indico.modules.events.contributions.operations.create_subcontribution(contrib, data)
indico.modules.events.contributions.operations.delete_contribution(contrib)
indico.modules.events.contributions.operations.delete_subcontribution(subcontrib)
indico.modules.events.contributions.operations.update_contribution(contrib, contrib_data, custom_fields_data=None)

Update a contribution.

Parameters
  • contrib – The Contribution to update

  • contrib_data – A dict containing the data to update

  • custom_fields_data – A dict containing the data for custom fields.

Returns

A dictionary containing information related to the update. unscheduled will be true if the modification resulted in the contribution being unscheduled. In this case undo_unschedule contains the necessary data to re-schedule it (undoing the session change causing it to be unscheduled)

indico.modules.events.contributions.operations.update_subcontribution(subcontrib, data)

Utilities

indico.modules.events.contributions.util.contribution_type_row(contrib_type)
indico.modules.events.contributions.util.generate_spreadsheet_from_contributions(contributions)

Return a tuple consisting of spreadsheet columns and respective contribution values.

indico.modules.events.contributions.util.get_boa_export_formats()
indico.modules.events.contributions.util.get_contributions_for_person(event, person, only_speakers=False)

Get all contributions for an event person.

If only_speakers is true, then only contributions where the person is a speaker are returned

indico.modules.events.contributions.util.get_contributions_for_user(event, user)

Get all contributions for a user in the given event.

indico.modules.events.contributions.util.get_contributions_with_user_as_submitter(event, user)

Get a list of contributions in which the user has submission rights.

indico.modules.events.contributions.util.get_events_with_linked_contributions(user, dt=None)

Return a dict with keys representing event_id and the values containing data about the user rights for contributions within the event.

Parameters
  • user – A User

  • dt – Only include events taking place on/after that date

indico.modules.events.contributions.util.has_contributions_with_user_as_submitter(event, user)
indico.modules.events.contributions.util.import_contributions_from_csv(event, f)

Import timetable contributions from a CSV file into an event.

indico.modules.events.contributions.util.make_contribution_form(event)

Extend the contribution WTForm to add the extra fields.

Each extra field will use a field named custom_ID.

Parameters

event – The Event for which to create the contribution form.

Returns

A ContributionForm subclass.

indico.modules.events.contributions.util.render_archive(event, contribs, sort_by, cls)
indico.modules.events.contributions.util.render_pdf(event, contribs, sort_by, cls)
indico.modules.events.contributions.util.serialize_contribution_for_ical(contrib)
indico.modules.events.contributions.util.sort_contribs(contribs, sort_by)
indico.modules.events.contributions.util.user_has_contributions(event, user)

Return True if a user has any contributions in the given event.