Agreement

Todo

Docstrings (module, models, utilities)

Models

class indico.modules.events.agreements.models.agreements.Agreement(**kwargs)

Agreements between a person and Indico.

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.

accept(from_ip, reason=None, on_behalf=False)
accepted
attachment

Attachment

attachment_filename

Filename and extension of the attachment

belongs_to(person)
static create_from_data(event, type_, person)
data

Definition-specific data of the agreement

property definition
event

The Event this agreement is associated with

event_id

ID of the event

id

Entry ID

identifier

Unique identifier within the event and type

is_orphan()
property locator
pending
person_email

Email of the person agreeing

person_name

Full name of the person agreeing

query: IndicoBaseQuery

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

reason

Explanation as to why the agreement was accepted/rejected

reject(from_ip, reason=None, on_behalf=False)
rejected
render(form, **kwargs)
reset()
signed_dt

The date and time the agreement was signed

signed_from_ip

The IP from which the agreement was signed

signed_on_behalf
state

A AgreementState

timestamp

The date and time the agreement was created

type

Type of agreement

user

The user this agreement is linked to

user_id

ID of a linked user

uuid

Entry universally unique ID

class indico.modules.events.agreements.models.agreements.AgreementState(value)

An enumeration.

accepted = 1
accepted_on_behalf = 3

agreement accepted on behalf of the person

pending = 0
rejected = 2
rejected_on_behalf = 4

agreement rejected on behalf of the person

Utilities

indico.modules.events.agreements.util.get_agreement_definitions()
indico.modules.events.agreements.util.send_new_agreements(event, name, people, email_body, cc_addresses, from_address)

Create and send agreements for a list of people on a given event.

Parameters:
  • event – The Event associated with the agreement

  • name – The agreement type matcing a AgreementDefinition name

  • people – The list of people for whom agreements will be created

  • email_body – The body of the email

  • cc_addresses – Email addresses to send CCs to

  • from_address – Email address of the sender

Placeholders

class indico.modules.events.agreements.placeholders.AgreementLinkPlaceholder
description = l'Link to the agreement page'

A short description of the placeholder.

name = 'agreement_link'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(definition, agreement)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

required = True

Whether the placeholder must be used at least once.

class indico.modules.events.agreements.placeholders.PersonNamePlaceholder
description = l'Name of the person'

A short description of the placeholder.

name = 'person_name'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(definition, agreement)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context