Contribution

Todo

Docstrings (module, models, operations, utilities)

Models

class indico.modules.events.contributions.models.contributions.Contribution(**kwargs)

Bases: indico.core.db.sqlalchemy.searchable.SearchableTitleMixin, indico.core.db.sqlalchemy.descriptions.SearchableDescriptionMixin, indico.core.db.sqlalchemy.protection.ProtectionManagersMixin, indico.core.db.sqlalchemy.locations.LocationMixin, indico.core.db.sqlalchemy.attachments.AttachedItemsMixin, indico.core.db.sqlalchemy.notes.AttachedNotesMixin, indico.modules.events.models.persons.PersonLinkDataMixin, indico.modules.events.models.persons.AuthorsSpeakersMixin, indico.modules.events.contributions.models.contributions.CustomFieldsMixin, sqlalchemy.orm.decl_api.Model

ATTACHMENT_FOLDER_ID_COLUMN = 'contribution_id'
PRELOAD_EVENT_ATTACHED_ITEMS = True
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
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()
duration
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.

duration_poster
enabled_editables

Return all submitted editables with enabled types.

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

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.

has_published_editables
id
inherit_location
inheriting_have_acl = True
is_deleted
is_paper_reviewer(user)
is_scheduled
is_user_associated(user, check_abstract=False)
keywords
location_backref_name = 'contributions'
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.

note
own_address
own_no_access_contact = None
own_room
own_room_id
own_room_name
own_venue
own_venue_id
own_venue_name
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

Persons associated with this contribution

possible_render_modes = {<RenderMode.html: 1>, <RenderMode.markdown: 2>}
classmethod preload_acl_entries(event)
protection_mode
protection_parent

The parent object to consult for ProtectionMode.inheriting.

references

External references associated with this contribution

render_mode
session
session_block
session_block_id
session_id
slug
start_dt
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.

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

Bases: object

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)

Bases: 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.

description
event
event_id
field
field_data
field_type
filter_choices
id
is_active
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.

mgmt_field
position
title
visibility
class indico.modules.events.contributions.models.fields.ContributionFieldValue(**kwargs)

Bases: indico.modules.events.contributions.models.fields.ContributionFieldValueBase

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'
contribution_field_id
contribution_id
data
class indico.modules.events.contributions.models.fields.ContributionFieldValueBase(**kwargs)

Bases: 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.

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

The name of the backref on the ContributionField

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

Bases: indico.util.enum.RichIntEnum

An enumeration.

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

Bases: int, indico.util.enum.IndicoEnum

An enumeration.

get_highest = <bound method AuthorType.get_highest of <enum 'AuthorType'>>
none = 0
primary = 1
secondary = 2

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

Association between EventPerson and Contribution.

author_type
contribution_id
display_order
id
is_author
is_speaker
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'
person
person_id

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

Association between EventPerson and SubContribution.

author_type = 0
display_order
id
is_speaker = True
object_relationship_name = 'subcontribution'
person
person_id
subcontribution_id
class indico.modules.events.contributions.models.principals.ContributionPrincipal(**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
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
local_group_id
multipass_group_name
multipass_group_provider
permissions
principal_backref_name = 'in_contribution_acls'
principal_for = 'Contribution'
read_access
registration_form
registration_form_id
type
unique_columns = ('contribution_id',)
user
user_id
class indico.modules.events.contributions.models.references.ContributionReference(**kwargs)

Bases: indico.modules.events.models.references.ReferenceModelBase

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
reference_backref_name = 'contribution_references'
reference_type
reference_type_id
value
class indico.modules.events.contributions.models.references.SubContributionReference(**kwargs)

Bases: indico.modules.events.models.references.ReferenceModelBase

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
reference_backref_name = 'subcontribution_references'
reference_type
reference_type_id
subcontribution_id
value
class indico.modules.events.contributions.models.subcontributions.SubContribution(**kwargs)

Bases: indico.core.db.sqlalchemy.searchable.SearchableTitleMixin, indico.core.db.sqlalchemy.descriptions.SearchableDescriptionMixin, indico.core.db.sqlalchemy.attachments.AttachedItemsMixin, indico.core.db.sqlalchemy.notes.AttachedNotesMixin, sqlalchemy.orm.decl_api.Model

ATTACHMENT_FOLDER_ID_COLUMN = 'subcontribution_id'
PRELOAD_EVENT_ATTACHED_ITEMS = True
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
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
is_protected
is_user_associated(user)
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.

note

Persons associated with this contribution

position
possible_render_modes = {<RenderMode.html: 1>, <RenderMode.markdown: 2>}
references

External references associated with this contribution

render_mode
room_name
session

Convenience property so all event entities have it.

slug
speakers
timetable_entry

Convenience property so all event entities have it.

title
venue_name
class indico.modules.events.contributions.models.types.ContributionType(**kwargs)

Bases: 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.

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

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, *, affiliations=False)

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_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)

Serialize ContributionPersonLink to JSON-like object.

indico.modules.events.contributions.util.sort_contribs(contribs, sort_by)