Request
Todo
Docstrings (module)
Models
- class indico.modules.events.requests.models.requests.Request(**kwargs)
Event-related requests, e.g. for a webcast.
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.
- property can_be_modified
Determine if the request can be modified or if a new one must be sent.
- comment
an optional comment for an accepted/rejected request
- created_by_id
ID of the user creating the request
- created_by_user
The user who created the request
- created_dt
the date/time the request was created
- data
plugin-specific data of the request
- property definition
- event
The Event this agreement is associated with
- event_id
ID of the event
- classmethod find_latest_for_event(event, type_=None)
Return the latest requests for a given event.
- id
request ID
- property locator
- processed_by_id
ID of the user processing the request
- processed_by_user
The user who processed the request
- processed_dt
the date/time the request was accepted/rejected
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model)
. Can be customized per-model by overridingquery_class
.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())
instead.
- state
the requests’s date, a
RequestState
value
- type
the request type name
Utilities
- indico.modules.events.requests.util.get_request_definitions()
Return a dict of request definitions.
- indico.modules.events.requests.util.is_request_manager(user)
Check if the user manages any request types.
- class indico.modules.events.requests.base.RequestDefinitionBase
A service request which can be sent by event managers.
- classmethod accept(req, data, user)
Accept the request.
To ensure that additional data is saved, this method should call :method:`manager_save`.
- Parameters:
req – the
Request
of the requestdata – the form data from the management form
user – the user processing the request
- classmethod can_be_managed(user)
Check whether the user is allowed to manage this request type.
- Parameters:
user – a
User
- classmethod create_form(event, existing_request=None)
Create the request form.
- Parameters:
event – the event the request is for
existing_request – the
Request
if there’s an existing request of this type
- Returns:
an instance of an
IndicoForm
subclass
- classmethod create_manager_form(req)
Create the request management form.
- Parameters:
req – the
Request
of the request- Returns:
an instance of an
IndicoForm
subclass
- form = None
the
IndicoForm
to use for the request form
- form_defaults = {}
default values to use if there’s no existing request
- classmethod get_manager_notification_emails(req)
Return the email addresses of users who manage requests of this type.
The email addresses are used only for notifications. It usually makes sense to return the email addresses of the users who pass the :method:`can_be_managed` check.
- Parameters:
req – the
Request
of the request- Returns:
set of email addresses
- classmethod get_notification_from_email(req, *, to_request_managers: bool)
Return the From e-mail address for notifications.
- Parameters:
req – the
Request
of the requestto_request_managers – whether the email is sent to request managers (event managers if False)
- classmethod get_notification_reply_email(req, *, to_request_managers: bool)
Return the Reply-To e-mail address for notifications.
- Parameters:
req – the
Request
of the requestto_request_managers – whether the email is sent to request managers (event managers if False)
- classmethod get_notification_template(name, **context)
Get the template module for a notification email.
- Parameters:
name – the template name
context – data passed to the template
- classmethod make_notification_email(req, template, *, to_request_managers: bool)
Make a notification email.
- Parameters:
req – the
Request
of the requesttemplate – the template module for the notification
to_request_managers – whether the email is sent to request managers (event managers if False)
- manager_form
the
IndicoForm
to use for the request manager formalias of
RequestManagerForm
- classmethod manager_save(req, data)
Save management-specific data.
This method is called when the management form is submitted without accepting/rejecting the request (which is guaranteed to be already accepted or rejected).
- Parameters:
req – the
Request
of the requestdata – the form data from the management form
- name = None
the unique internal name of the request type
- plugin = None
the plugin containing this request definition - assigned automatically
- classmethod reject(req, data, user)
Reject the request.
To ensure that additional data is saved, this method should call :method:`manager_save`.
- Parameters:
req – the
Request
of the requestdata – the form data from the management form
user – the user processing the request
- classmethod render_form(event, **kwargs)
Render the request form.
- Parameters:
event – the event the request is for
kwargs – arguments passed to the template
- classmethod send(req, data)
Send a new/modified request.
- Parameters:
req – the
Request
of the requestdata – the form data from the request form
- title = None
the title of the request type as shown to users
- classmethod withdraw(req, notify_event_managers=True)
Withdraw the request.
- Parameters:
req – the
Request
of the requestnotify_event_managers – if event managers should be notified